summaryrefslogtreecommitdiff
path: root/test/DocutilsTestSupport.py
diff options
context:
space:
mode:
authorgoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-05-07 21:31:42 +0000
committergoodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2004-05-07 21:31:42 +0000
commitc3446fab679133b8d74ffbcefc1bbe6bc9ebaccb (patch)
treea66b439d19d98a108b64184c8b504ffeb827920c /test/DocutilsTestSupport.py
parent4e2a0c51ca5e9a911b281a1547b4f258ee994061 (diff)
downloaddocutils-c3446fab679133b8d74ffbcefc1bbe6bc9ebaccb.tar.gz
added Python version checking
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2048 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/DocutilsTestSupport.py')
-rw-r--r--test/DocutilsTestSupport.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/DocutilsTestSupport.py b/test/DocutilsTestSupport.py
index 126448b4b..0af838e1c 100644
--- a/test/DocutilsTestSupport.py
+++ b/test/DocutilsTestSupport.py
@@ -56,10 +56,9 @@ from docutils.parsers.rst import states, tableparser, roles, languages
from docutils.readers import standalone, pep
from docutils.statemachine import StringList, string2lines
-try:
+if sys.hexversion >= 0x02020000: # Python 2.2
from docutils.readers.python import moduleparser
- from tokenize import generate_tokens # new in Python 2.2
-except:
+else:
moduleparser = None
try:
@@ -540,11 +539,6 @@ class PythonModuleParserTestSuite(CustomTestSuite):
A collection of PythonModuleParserTestCase.
"""
- if moduleparser is None:
- PythonModuleParserTestCase.test_parser = CustomTestCase.skip_test
- PythonModuleParserTestCase.test_token_parser_rhs = \
- CustomTestCase.skip_test
-
def generateTests(self, dict, dictname='totest',
testmethod='test_parser'):
"""
@@ -571,6 +565,14 @@ class PythonModuleParserTestSuite(CustomTestSuite):
id='%s[%r][%s]' % (dictname, name, casenum),
run_in_debugger=run_in_debugger)
+ if moduleparser is None:
+ # Skip Python Source Reader tests for Python < 2.2:
+ def generateTests(*args, **kwargs): pass
+
+ #PythonModuleParserTestCase.test_parser = CustomTestCase.skip_test
+ #PythonModuleParserTestCase.test_token_parser_rhs = \
+ # CustomTestCase.skip_test
+
class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec):