diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2012-06-22 19:49:51 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2012-06-22 19:49:51 +0000 |
| commit | b0da1015b2587d7e5b01f38f7f0a3f697c8052c9 (patch) | |
| tree | 8001d2c41f4e3dd8a7345f9168bb2c8dd2024eac /docutils | |
| parent | ebf8b6f161b2a408f5b09ba0a6062e7959c34e85 (diff) | |
| download | docutils-b0da1015b2587d7e5b01f38f7f0a3f697c8052c9.tar.gz | |
Drop support for Python 2.3.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7463 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
24 files changed, 42 insertions, 307 deletions
diff --git a/docutils/FAQ.txt b/docutils/FAQ.txt index 24dbdad4f..48f24cd4e 100644 --- a/docutils/FAQ.txt +++ b/docutils/FAQ.txt @@ -527,77 +527,10 @@ be indented and that ambiguous cases be escaped. How can I include mathematical equations in documents? ------------------------------------------------------ -There is no elegant built-in way, yet. There are several ideas, but -no obvious winner. This issue requires a champion to solve the -technical and aesthetic issues and implement a generic solution. -Here's the `to-do list entry`__. +Use the `math directive`_ and `math role`_, available since Docutils 0.8. -__ docs/dev/todo.html#math-markup - -There are several quick & dirty ways to include equations in documents. -They all presently use LaTeX syntax or dialects of it. - -* For LaTeX output, nothing beats raw LaTeX math. A simple way is to - use the `raw directive`_:: - - .. raw:: latex - - \[ x^3 + 3x^2a + 3xa^2 + a^3, \] - - For inline math you could use substitutions of the raw directive but - the recently added `raw role`_ is more convenient. You must define a - custom role based on it once in your document:: - - .. role:: raw-latex(raw) - :format: latex - - and then you can just use the new role in your text:: - - the binomial expansion of :raw-latex:`$(x+a)^3$` is - - .. _raw directive: docs/ref/rst/directives.html#raw-data-pass-through - .. _raw role: docs/ref/rst/roles.html#raw - -* Jens Jørgen Mortensen has implemented a "latex-math" role and - directive, available from `his sandbox`__. - - __ http://docutils.sourceforge.net/sandbox/jensj/latex_math/ - -* For HTML the "Right" w3c-standard way to include math is MathML_. - Unfortunately its rendering is still quite broken (or absent) on many - browsers but it's getting better. Another bad problem is that typing - or reading raw MathML by humans is *really* painful, so embedding it - in a reST document with the raw directive would defy the goals of - readability and editability of reST (see an `example of raw MathML - <http://sf.net/mailarchive/message.php?msg_id=2177102>`__). - - A much less painful way to generate HTML+MathML is to use itex2mml_ to - convert a dialect of LaTeX syntax to presentation MathML. Here is an - example of potential `itex math markup - <http://article.gmane.org/gmane.text.docutils.user/118>`__. The - simplest way to use it is to add ``html`` to the format lists for the - raw directive/role and postprocess the resulting document with - itex2mml. This way you can *generate LaTeX and HTML+MathML from the - same source*, but you must limit yourself to the intersection of LaTeX - and itex markups for this to work. Alan G. Isaac wrote a detailed - HOWTO_ for this approach. - - .. _MathML: http://www.w3.org/Math/ - .. _itex2mml: http://pear.math.pitt.edu/mathzilla/itex2mml.html - .. _HOWTO: http://www.american.edu/econ/itex2mml/mathhack.rst - -* The other way to add math to HTML is to use images of the equations, - typically generated by TeX. This is inferior to MathML in the long - term but is perhaps more accessible nowdays. - - Of course, doing it by hand is too much work. Beni Cherniavsky has - written some `preprocessing scripts`__ for converting the - ``texmath`` role/directive into images for HTML output and raw - directives/subsitution for LaTeX output. This way you can *generate - LaTeX and HTML+images from the same source*. `Instructions here`__. - - __ http://docutils.sourceforge.net/sandbox/cben/rolehack/ - __ http://docutils.sourceforge.net/sandbox/cben/rolehack/README.html +.. _math directive: docs/ref/rst/directives.html#math +.. _math role: docs/ref/rst/roles.html#math Is nested inline markup possible? @@ -938,9 +871,9 @@ What is the status of the HTML Writer? The HTML Writer module, ``docutils/writers/html4css1.py``, is a proof-of-concept reference implementation. While it is a complete -implementation, some aspects of the HTML it produces may be -incompatible with older browsers or specialized applications (such as -web templating). Alternate implementations are welcome. +implementation, some aspects of the HTML it produces may be incompatible +with older browsers or specialized applications (such as web templating). +The sandbox has some alternative HTML writers, contributions are welcome. What kind of HTML does it produce? @@ -964,7 +897,7 @@ What browsers are supported? No specific browser is targeted; all modern graphical browsers should work. Some older browsers, text-only browsers, and browsers without full CSS support are known to produce inferior results. Firefox, -Safari, Mozilla (version 1.0 and up), and MS Internet Explorer +Safari, Mozilla (version 1.0 and up), Opera, and MS Internet Explorer (version 5.0 and up) are known to give good results. Reports of experiences with other browsers are welcome. @@ -1243,13 +1176,9 @@ Can I use Docutils for Python auto-documentation? Yes, in conjunction with other projects. -Docstring extraction functionality from within Docutils is still under -development. There is most of a source code parsing module in -docutils/readers/python/moduleparser.py. We do plan to finish it -eventually. Ian Bicking wrote an initial front end for the -moduleparser.py module, in sandbox/ianb/extractor/extractor.py. Ian -also did some work on the Python Source Reader -(docutils.readers.python) component at PyCon DC 2004. +The Sphinx_ documentation generator includes an autodoc module. + +.. _Sphinx: http://sphinx.pocoo.org/index.html Version 2.0 of Ed Loper's `Epydoc <http://epydoc.sourceforge.net/>`_ supports reStructuredText-format docstrings for HTML output. Docutils diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt index 20543d855..793177ca1 100644 --- a/docutils/HISTORY.txt +++ b/docutils/HISTORY.txt @@ -16,6 +16,10 @@ Changes Since 0.9.1 =================== +* General + + - Dropped support for Python 2.3. + Release 0.9.1 (2012-06-17) ========================== diff --git a/docutils/README.txt b/docutils/README.txt index 57535acfb..bd8db38f4 100644 --- a/docutils/README.txt +++ b/docutils/README.txt @@ -16,7 +16,7 @@ Quick-Start This is for those who want to get up & running quickly. -1. Docutils requires Python (version 2.3 or later), available from +1. Docutils requires Python (version 2.4 or later), available from http://www.python.org/ @@ -102,7 +102,7 @@ Requirements ============ To run the code, Python_ must be installed. -Docutils is compatible with Python versions from 2.3 up to 2.7 and +Docutils is compatible with Python versions from 2.4 up to 2.7 and versions 3.1 and 3.2 (cf. `Python 3 compatibility`_). Docutils uses the following packages for enhanced functionality, if they are diff --git a/docutils/RELEASE-NOTES.txt b/docutils/RELEASE-NOTES.txt index aba4133f5..9b074c374 100644 --- a/docutils/RELEASE-NOTES.txt +++ b/docutils/RELEASE-NOTES.txt @@ -19,8 +19,6 @@ more detailed list of changes, please see the `Docutils History`_. Future changes ============== -* Support for Python 2.3 will be dropped in version 0.10. - * docutils/math, docutils/error_reporting.py, and docutils/urischemes.py will move to the utils package Code importing these modules needs to adapt, e.g.:: @@ -48,6 +46,15 @@ Future changes Changes Since 0.9.1 =================== +.. Note:: + + Docutils 0.9.x is the last version supporting Python 2.3. + + Docutils 0.10 is compatible with Python versions from 2.4 to 2.7, + as well as 3.1 and 3.2 (cf. `Python 3 compatibility`_). + +.. _Python 3 compatibility: README.html#python-3-compatibility + Release 0.9.1 (2012-06-17) ========================== diff --git a/docutils/docs/dev/distributing.txt b/docutils/docs/dev/distributing.txt index ef3dd854d..9224a3000 100644 --- a/docutils/docs/dev/distributing.txt +++ b/docutils/docs/dev/distributing.txt @@ -28,7 +28,7 @@ Dependencies Docutils has the following dependencies: -* Python 2.3 or later is required. Use ">= Python 2.3" in the +* Python 2.4 or later is required. Use ">= Python 2.4" in the dependencies. * Docutils may optionally make use of the PIL (`Python Imaging diff --git a/docutils/docs/dev/policies.txt b/docutils/docs/dev/policies.txt index 03dc50e18..f3a85ebce 100644 --- a/docutils/docs/dev/policies.txt +++ b/docutils/docs/dev/policies.txt @@ -88,7 +88,7 @@ How to make code contributions that are easily accepted: Testing`_ for a description of the test suite in ``docutils/test/``. Ensure the addition works with all supported Python versions - (2.3 ... 3.2). + (2.4 ... 3.2). * Look at the Docutils sources to see how similar features are implemented, learn to do it "the Docutils way". diff --git a/docutils/docs/dev/testing.txt b/docutils/docs/dev/testing.txt index c2b640798..91dbccabc 100644 --- a/docutils/docs/dev/testing.txt +++ b/docutils/docs/dev/testing.txt @@ -33,23 +33,21 @@ be sure that you haven't broken anything. From a shell:: Python Versions =============== -The Docutils 0.6 release supports Python 2.3 or later. Therefore, you should -actually have Pythons 2.3, as well as the latest Python (2.6 at the time +The Docutils 0.10 release supports Python 2.4 or later. Therefore, you should +actually have Pythons 2.4, as well as the latest Python (3.2 at the time of this writing) installed and always run the tests on all of them. (A good way to do that is to always run the test suite through a short script that runs ``alltests.py`` under each version of Python.) If you can't afford -installing 3 or more Python versions, the edge cases (2.3, and 2.6) should +installing 3 or more Python versions, the edge cases (2.4, and 3.2) should cover most of it. Good resources covering the differences between Python versions: -* `What's New in Python 2.3`__ * `What's New in Python 2.4`__ * `What's New in Python 2.5`__ * `What's New in Python 2.6`__ * `PEP 290 - Code Migration and Modernization`__ -__ http://www.python.org/doc/2.3.5/whatsnew/whatsnew23.html __ http://www.python.org/doc/2.4.4/whatsnew/whatsnew24.html __ http://www.python.org/doc/2.5.2/whatsnew/whatsnew25.html __ http://docs.python.org/whatsnew/2.6.html diff --git a/docutils/docs/user/config.txt b/docutils/docs/user/config.txt index a6005380d..eb861c2d5 100644 --- a/docutils/docs/user/config.txt +++ b/docutils/docs/user/config.txt @@ -260,8 +260,8 @@ _`error_encoding_error_handler` The error handler for unencodable characters in error output. See output_encoding_error_handler_ for acceptable values. - Default: "backslashreplace" for Python 2.3 and later; "replace" - otherwise. Options: ``--error-encoding-error-handler, + Default: "backslashreplace" + Options: ``--error-encoding-error-handler, --error-encoding, -e``. _`exit_status_level` @@ -376,8 +376,7 @@ _`output_encoding_error_handler` Replace with the appropriate XML character reference, such as "``†``". backslashreplace - (Python 2.3+) Replace with backslashed escape sequences, such - as "``\u2020``". + Replace with backslashed escape sequences, such as "``\u2020``". Acceptable values are the same as for the "error" parameter of Python's ``encode`` string method; other values may be defined in @@ -659,9 +658,9 @@ Under construction. .. Caution:: - * In versions older than 2.7.3 and 3.2.3, the newlines_ and indents_ - options may adversely affect whitespace; use them only for reading - convenience (see http://bugs.python.org/issue4147). + * In Python versions older than 2.7.3 and 3.2.3, the newlines_ and + indents_ options may adversely affect whitespace; use them only for + reading convenience (see http://bugs.python.org/issue4147). * The XML declaration carries text encoding information, without which standard tools may be unable to read the generated XML. diff --git a/docutils/docs/user/rst/cheatsheet.txt b/docutils/docs/user/rst/cheatsheet.txt index 40910deac..1ad2c852e 100644 --- a/docutils/docs/user/rst/cheatsheet.txt +++ b/docutils/docs/user/rst/cheatsheet.txt @@ -91,7 +91,7 @@ compound Compound paragraphs [0.3.6] container Generic block-level container element [0.3.10] table Create a titled table [0.3.1] list-table Create a table from a uniform two-level bullet list [0.3.8] -csv-table Create a table from CSV data (requires Python 2.3+) [0.3.4] +csv-table Create a table from CSV data [0.3.4] contents Generate a table of contents sectnum Automatically number sections, subsections, etc. header, footer Create document decorations [0.3.8] diff --git a/docutils/docutils/_string_template_compat.py b/docutils/docutils/_string_template_compat.py deleted file mode 100644 index 38929c296..000000000 --- a/docutils/docutils/_string_template_compat.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf8 -*- - -# string_template_compat.py: string.Template for Python <= 2.4 -# ===================================================== - -# This is just an excerpt of the standard string module to provide backwards -# compatibility. - -import re as _re - -class _multimap: - """Helper class for combining multiple mappings. - - Used by .{safe_,}substitute() to combine the mapping and keyword - arguments. - """ - def __init__(self, primary, secondary): - self._primary = primary - self._secondary = secondary - - def __getitem__(self, key): - try: - return self._primary[key] - except KeyError: - return self._secondary[key] - - -class _TemplateMetaclass(type): - pattern = r""" - %(delim)s(?: - (?P<escaped>%(delim)s) | # Escape sequence of two delimiters - (?P<named>%(id)s) | # delimiter and a Python identifier - {(?P<braced>%(id)s)} | # delimiter and a braced identifier - (?P<invalid>) # Other ill-formed delimiter exprs - ) - """ - - def __init__(cls, name, bases, dct): - super(_TemplateMetaclass, cls).__init__(name, bases, dct) - if 'pattern' in dct: - pattern = cls.pattern - else: - pattern = _TemplateMetaclass.pattern % { - 'delim' : _re.escape(cls.delimiter), - 'id' : cls.idpattern, - } - cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE) - - -class Template: - """A string class for supporting $-substitutions.""" - __metaclass__ = _TemplateMetaclass - - delimiter = '$' - idpattern = r'[_a-z][_a-z0-9]*' - - def __init__(self, template): - self.template = template - - # Search for $$, $identifier, ${identifier}, and any bare $'s - - def _invalid(self, mo): - i = mo.start('invalid') - lines = self.template[:i].splitlines(True) - if not lines: - colno = 1 - lineno = 1 - else: - colno = i - len(''.join(lines[:-1])) - lineno = len(lines) - raise ValueError('Invalid placeholder in string: line %d, col %d' % - (lineno, colno)) - - def substitute(self, *args, **kws): - if len(args) > 1: - raise TypeError('Too many positional arguments') - if not args: - mapping = kws - elif kws: - mapping = _multimap(kws, args[0]) - else: - mapping = args[0] - # Helper function for .sub() - def convert(mo): - # Check the most common path first. - named = mo.group('named') or mo.group('braced') - if named is not None: - val = mapping[named] - # We use this idiom instead of str() because the latter will - # fail if val is a Unicode containing non-ASCII characters. - return '%s' % (val,) - if mo.group('escaped') is not None: - return self.delimiter - if mo.group('invalid') is not None: - self._invalid(mo) - raise ValueError('Unrecognized named group in pattern', - self.pattern) - return self.pattern.sub(convert, self.template) - - def safe_substitute(self, *args, **kws): - if len(args) > 1: - raise TypeError('Too many positional arguments') - if not args: - mapping = kws - elif kws: - mapping = _multimap(kws, args[0]) - else: - mapping = args[0] - # Helper function for .sub() - def convert(mo): - named = mo.group('named') - if named is not None: - try: - # We use this idiom instead of str() because the latter - # will fail if val is a Unicode containing non-ASCII - return '%s' % (mapping[named],) - except KeyError: - return self.delimiter + named - braced = mo.group('braced') - if braced is not None: - try: - return '%s' % (mapping[braced],) - except KeyError: - return self.delimiter + '{' + braced + '}' - if mo.group('escaped') is not None: - return self.delimiter - if mo.group('invalid') is not None: - return self.delimiter - raise ValueError('Unrecognized named group in pattern', - self.pattern) - return self.pattern.sub(convert, self.template) - diff --git a/docutils/docutils/utils/punctuation_chars.py b/docutils/docutils/utils/punctuation_chars.py index eb0ed8a8c..b8dbe2b43 100644 --- a/docutils/docutils/utils/punctuation_chars.py +++ b/docutils/docutils/utils/punctuation_chars.py @@ -68,9 +68,8 @@ def unicode_charlists(categories, cp_min=0, cp_max=None): # (may shorten the search time considerably if there are many # categories with not too high characters): if cp_max is None: - # python 2.3: list comprehension instead of generator required - cp_max = max([x for x in xrange(sys.maxunicode + 1) - if unicodedata.category(unichr(x)) in categories]) + cp_max = max(x for x in xrange(sys.maxunicode + 1) + if unicodedata.category(unichr(x)) in categories) # print cp_max # => 74867 for unicode_punctuation_categories charlists = {} for cat in categories: diff --git a/docutils/docutils/writers/latex2e/__init__.py b/docutils/docutils/writers/latex2e/__init__.py index 4db4036d9..8c58806e3 100644 --- a/docutils/docutils/writers/latex2e/__init__.py +++ b/docutils/docutils/writers/latex2e/__init__.py @@ -28,11 +28,6 @@ from docutils.error_reporting import SafeString from docutils.transforms import writer_aux from docutils.math import pick_math_environment, unichar2tex -# compatibility module for Python 2.3 -if not hasattr(string, 'Template'): - import docutils._string_template_compat - string.Template = docutils._string_template_compat.Template - class Writer(writers.Writer): supported = ('latex','latex2e') diff --git a/docutils/setup.py b/docutils/setup.py index d055058fb..fb8037a4d 100755 --- a/docutils/setup.py +++ b/docutils/setup.py @@ -214,8 +214,7 @@ classifiers = [ ] # BUG pypi did not like fllowing languages # 'Natural Language :: Lithuanian', -"""Trove classifiers for the Distutils "register" command; -Python 2.3 and up.""" +"""Trove classifiers for the Distutils "register" command.""" if __name__ == '__main__' : do_setup() diff --git a/docutils/test/DocutilsTestSupport.py b/docutils/test/DocutilsTestSupport.py index dae25ccc3..edece3fac 100644 --- a/docutils/test/DocutilsTestSupport.py +++ b/docutils/test/DocutilsTestSupport.py @@ -129,10 +129,6 @@ class StandardTestCase(unittest.TestCase): raise self.failureException, \ (msg or '%s == %s' % _format_str(first, second)) - # python 2.3 - if not hasattr(unittest.TestCase, "assertTrue"): - assertTrue = unittest.TestCase.failUnless - # aliases for assertion methods, deprecated since Python 2.7 failUnlessEqual = assertEquals = assertEqual diff --git a/docutils/test/test_dependencies.py b/docutils/test/test_dependencies.py index c48700dd3..7fd971c85 100755 --- a/docutils/test/test_dependencies.py +++ b/docutils/test/test_dependencies.py @@ -29,10 +29,6 @@ paths = {'include': u'data/include.txt', # included rst file class RecordDependenciesTests(unittest.TestCase): - # python 2.3 - if not hasattr(unittest.TestCase, "assertTrue"): - assertTrue = unittest.TestCase.failUnless - def get_record(self, **settings): recordfile = 'record.txt' recorder = docutils.utils.DependencyList(recordfile) @@ -40,12 +36,7 @@ class RecordDependenciesTests(unittest.TestCase): settings.setdefault('source_path', os.path.join('data', 'dependencies.txt')) settings.setdefault('settings_overrides', {}) - if sys.version_info < (2, 4): - # python 2.3 update() takes no keyword arguments - settings['settings_overrides'].update({"_disable_config":True, - "record_dependencies":recorder}) - else: - settings['settings_overrides'].update(_disable_config=True, + settings['settings_overrides'].update(_disable_config=True, record_dependencies=recorder) docutils.core.publish_file(destination=DocutilsTestSupport.DevNull(), **settings) diff --git a/docutils/test/test_io.py b/docutils/test/test_io.py index 1d213ce7a..13f25abe0 100755 --- a/docutils/test/test_io.py +++ b/docutils/test/test_io.py @@ -15,10 +15,6 @@ from docutils._compat import b, bytes from docutils.error_reporting import locale_encoding from test_error_reporting import BBuf, UBuf -# python 2.3 -if not hasattr(unittest.TestCase, "assertTrue"): - assertTrue = unittest.TestCase.failUnless - class mock_stdout(UBuf): encoding = 'utf8' diff --git a/docutils/test/test_nodes.py b/docutils/test/test_nodes.py index 1fc3477c4..ef423b4c4 100755 --- a/docutils/test/test_nodes.py +++ b/docutils/test/test_nodes.py @@ -18,11 +18,6 @@ from docutils._compat import b debug = False -# python 2.3 -if not hasattr(unittest.TestCase, "assertTrue"): - # HACK? this changes TestCase, fixes the problem for tests executing afterwards. - # this tests break if run alone - unittest.TestCase.assertTrue = unittest.TestCase.failUnless class TextTests(unittest.TestCase): @@ -250,8 +245,6 @@ class MiscTests(unittest.TestCase): (u'\u024b q with hook tail', 'q-q-with-hook-tail'), (u'\u024d r with stroke', 'r-r-with-stroke'), (u'\u024f y with stroke', 'y-y-with-stroke'), - ] - ids_unicode_not_2_2 = [ # From Latin-1 Supplements (u'\u00e0: a with grave', 'a-a-with-grave'), (u'\u00e1 a with acute', 'a-a-with-acute'), @@ -384,9 +377,6 @@ class MiscTests(unittest.TestCase): def test_make_id(self): failures = [] tests = self.ids + self.ids_unicode_all - import sys - if sys.version_info[:2] != (2, 2): - tests += self.ids_unicode_not_2_2 for input, expect in tests: output = nodes.make_id(input) if expect != output: diff --git a/docutils/test/test_parsers/test_parser.py b/docutils/test/test_parsers/test_parser.py index bd305d9da..29be2ab98 100644 --- a/docutils/test/test_parsers/test_parser.py +++ b/docutils/test/test_parsers/test_parser.py @@ -26,7 +26,7 @@ class RstParserTests(unittest.TestCase): if sys.version_info < (3,): # supplying string input is supported, but only if ascii-decodable - self.assertRaises(UnicodeError, # UnicodeDecodeError since py2.3 + self.assertRaises(UnicodeDecodeError, parser.parse, b('hol%s' % chr(224)), document) else: # input must be unicode at all times diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_tables.py b/docutils/test/test_parsers/test_rst/test_directives/test_tables.py index 3ba24475b..924cf7793 100755 --- a/docutils/test/test_parsers/test_rst/test_directives/test_tables.py +++ b/docutils/test/test_parsers/test_rst/test_directives/test_tables.py @@ -1070,18 +1070,6 @@ 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') diff --git a/docutils/test/test_settings.py b/docutils/test/test_settings.py index fa5e8b34b..e5f0a2b22 100755 --- a/docutils/test/test_settings.py +++ b/docutils/test/test_settings.py @@ -23,11 +23,6 @@ from docutils.parsers import rst warnings.filterwarnings(action='ignore', category=frontend.ConfigDeprecationWarning) -# python 2.3 -if not hasattr(unittest.TestCase, "assertTrue"): - # HACK? this changes TestCase, fixes the problem for tests executing afterwards. - # this tests break if run alone - unittest.TestCase.assertTrue = unittest.TestCase.failUnless def fixpath(path): return os.path.abspath(os.path.join(*(path.split('/')))) diff --git a/docutils/test/test_statemachine.py b/docutils/test/test_statemachine.py index e33f91736..2422adcda 100755 --- a/docutils/test/test_statemachine.py +++ b/docutils/test/test_statemachine.py @@ -13,11 +13,6 @@ import sys import re from DocutilsTestSupport import statemachine -# python 2.3 -if not hasattr(unittest.TestCase, "assertTrue"): - # HACK? this changes TestCase, fixes the problem for tests executing afterwards. - # this tests break if run alone - unittest.TestCase.assertTrue = unittest.TestCase.failUnless debug = False testtext = statemachine.string2lines("""\ diff --git a/docutils/test/test_traversals.py b/docutils/test/test_traversals.py index 76acd19ec..b0a65107d 100755 --- a/docutils/test/test_traversals.py +++ b/docutils/test/test_traversals.py @@ -52,10 +52,6 @@ class AttentiveWriter(writers.Writer): class StopTraversalTests(unittest.TestCase, docutils.SettingsSpec): - # python 2.3 - if not hasattr(unittest.TestCase, "assertTrue"): - assertTrue = unittest.TestCase.failUnless - """ Test interrupting the visitor during traversal. In this test we stop it when we reach an attention node. diff --git a/docutils/test/test_viewlist.py b/docutils/test/test_viewlist.py index e1014f7f5..416915da5 100755 --- a/docutils/test/test_viewlist.py +++ b/docutils/test/test_viewlist.py @@ -16,10 +16,6 @@ from DocutilsTestSupport import statemachine class ViewListTests(unittest.TestCase): - # python 2.3 - if not hasattr(unittest.TestCase, "assertTrue"): - assertTrue = unittest.TestCase.failUnless - a_list = list('abcdefg') b_list = list('AEIOU') c_list = list('XYZ') diff --git a/docutils/test/test_writers/test_latex2e.py b/docutils/test/test_writers/test_latex2e.py index bad705c5f..36accd206 100755 --- a/docutils/test/test_writers/test_latex2e.py +++ b/docutils/test/test_writers/test_latex2e.py @@ -10,11 +10,6 @@ Tests for latex2e writer. """ import string -# compatibility module for Python 2.3 -if not hasattr(string, 'Template'): - import docutils._string_template_compat - string.Template = docutils._string_template_compat.Template - from __init__ import DocutilsTestSupport def suite(): |
