diff options
author | strank <strank@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2008-07-25 06:43:16 +0000 |
---|---|---|
committer | strank <strank@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2008-07-25 06:43:16 +0000 |
commit | 682cc714853be29d142558b771d14c76c340918f (patch) | |
tree | b54447e31d0f3717bc5bd14583717fd762c58022 | |
parent | 01730ef3a1609fd8e1bf8ce1970436cb559d1b9e (diff) | |
download | docutils-abolish-userstring-haskey.tar.gz |
Special-case tests with IOError on older python versions. abolish-userstring-haskey
git-svn-id: http://svn.code.sf.net/p/docutils/code/branches/abolish-userstring-haskey@5616 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rwxr-xr-x | test/test_parsers/test_rst/test_directives/test_raw.py | 12 | ||||
-rwxr-xr-x | test/test_parsers/test_rst/test_directives/test_tables.py | 14 |
2 files changed, 24 insertions, 2 deletions
diff --git a/test/test_parsers/test_rst/test_directives/test_raw.py b/test/test_parsers/test_rst/test_directives/test_raw.py index 06354acae..1e2d9c5ca 100755 --- a/test/test_parsers/test_rst/test_directives/test_raw.py +++ b/test/test_parsers/test_rst/test_directives/test_raw.py @@ -157,7 +157,7 @@ Raw input file is UTF-16-encoded, and is not valid ASCII. <literal_block xml:space="preserve"> .. raw:: html :file: non-existent.file -"""], +"""], # note that this output is rewritten below for certain python versions ] # Skip tests whose output contains "UnicodeDecodeError" if we are not @@ -171,6 +171,16 @@ if sys.version_info < (2, 3): # Assume we have only one of these tests. break +# Rewrite tests that depend on the output of IOError as it is +# platform-dependent before python 2.4 for a unicode path. +if sys.version_info < (2, 4): + # remove the unicode repr u except for py2.3 on windows: + if not sys.platform.startswith('win') or sys.version_info < (2, 3): + for i in range(len(totest['raw'])): + if totest['raw'][i][1].find("u'non-existent.file'") != -1: + totest['raw'][i][1] = totest['raw'][i][1].replace( + "u'non-existent.file'", "'non-existent.file'") + if __name__ == '__main__': import unittest diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py index d474419d5..d97516767 100755 --- a/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/test/test_parsers/test_rst/test_directives/test_tables.py @@ -566,7 +566,7 @@ u"""\ <literal_block xml:space="preserve"> .. csv-table:: no such file :file: bogus.csv -"""], +"""], # note that this output is rewritten below for certain python versions ["""\ .. csv-table:: bad URL :url: bogus.csv @@ -1074,6 +1074,18 @@ totest['list-table'] = [ ] +if csv: + # Rewrite csv tests that depend on the output of IOError as it is + # platform-dependent before python 2.4 for a unicode path. + # Here only needed for python 2.3 on non-windows + import sys + if sys.version_info < (2, 4) and not sys.platform.startswith('win'): + for i in range(len(totest['csv-table'])): + if totest['csv-table'][i][1].find("u'bogus.csv'") != -1: + totest['csv-table'][i][1] = totest['csv-table'][i][1].replace( + "u'bogus.csv'", "'bogus.csv'") + + if __name__ == '__main__': import unittest unittest.main(defaultTest='suite') |