##// END OF EJS Templates
tests: introduce doctest_mock_ugettext to allow doctests of localized code...
Thomas De Schampheleire -
r7658:3929ff3f default
parent child Browse files
Show More
@@ -22,3 +22,16 b' def pytest_ignore_collect(path):'
22 )
22 )
23 if str(path).endswith(kallithea_ignore_paths):
23 if str(path).endswith(kallithea_ignore_paths):
24 return True
24 return True
25
26 @pytest.fixture()
27 def doctest_mock_ugettext(request):
28 """Mock ugettext ('_') in the module using this fixture.
29
30 Intended to be used for doctests.
31
32 In a doctest, enable this fixture using:
33 >>> getfixture('doctest_mock_ugettext')
34 """
35 m = __import__(request.module.__name__, globals(), locals(), [None], 0)
36 with mock.patch.object(m, '_', lambda s: s):
37 yield
General Comments 0
You need to be logged in to leave comments. Login now