diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-01-09 03:06:58 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-01-09 03:06:58 +0000 |
| commit | a0d0e184a40c06298879d1dec4ba2271afca31d5 (patch) | |
| tree | c69d36405ae867d3e55b20db3af5cbf59aa7b6a5 | |
| parent | 5f640a76baf0f109a02f81ada358d9ade22cc46c (diff) | |
| download | docutils-a0d0e184a40c06298879d1dec4ba2271afca31d5.tar.gz | |
moved clear_roles to DocutilsTestSupport.CustomTestCase so that it is used globally
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@4254 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
| -rw-r--r-- | docutils/test/DocutilsTestSupport.py | 17 | ||||
| -rwxr-xr-x | docutils/test/test_functional.py | 9 |
2 files changed, 15 insertions, 11 deletions
diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py index c3c0aa2a2..1fbecbb32 100644 --- a/docutils/test/DocutilsTestSupport.py +++ b/docutils/test/DocutilsTestSupport.py @@ -172,6 +172,21 @@ class CustomTestCase(StandardTestCase): def __repr__(self): return "<%s %s>" % (self.id, unittest.TestCase.__repr__(self)) + def clear_roles(self): + # Language-specific roles and roles added by the + # "default-role" and "role" directives are currently stored + # globally in the roles._roles dictionary. This workaround + # empties that dictionary. + roles._roles = {} + + def setUp(self): + StandardTestCase.setUp(self) + self.clear_roles() + + def tearDown(self): + StandardTestCase.tearDown(self) + self.clear_roles() + def compare_output(self, input, output, expected): """`input`, `output`, and `expected` should all be strings.""" if isinstance(input, UnicodeType): @@ -421,8 +436,6 @@ class ParserTestCase(CustomTestCase): settings = self.settings.copy() settings.__dict__.update(self.suite_settings) document = utils.new_document('test data', settings) - # Remove any additions made by "role" directives: - roles._roles = {} self.parser.parse(self.input, document) output = document.pformat() self.compare_output(self.input, output, self.expected) diff --git a/docutils/test/test_functional.py b/docutils/test/test_functional.py index 42b4fea20..dcec9cf45 100755 --- a/docutils/test/test_functional.py +++ b/docutils/test/test_functional.py @@ -81,15 +81,6 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): del kwargs['configfile'] DocutilsTestSupport.CustomTestCase.__init__(self, *args, **kwargs) - def clear_roles(self): - # Language-specific roles and the default role of the reST - # parser are currently set globally in the roles._roles - # dictionary. This workaround empties that dictionary. - from docutils.parsers.rst import roles - roles._roles = {} - - setUp = tearDown = clear_roles - def shortDescription(self): return 'test_functional.py: ' + self.configfile |
