From 9650cd6276ae83264291419f9d74f8c73d514358 Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 12:41:02 +0100 Subject: [PATCH 1/9] Support `.encode()` keyword arguments for Python 2.6. --- mwparserfromhell/string_mixin.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mwparserfromhell/string_mixin.py b/mwparserfromhell/string_mixin.py index 3599fe4..10c88e3 100644 --- a/mwparserfromhell/string_mixin.py +++ b/mwparserfromhell/string_mixin.py @@ -32,6 +32,15 @@ from .compat import bytes, py3k, str __all__ = ["StringMixIn"] +def inheritdoc(method): + """Set __doc__ of *method* to __doc__ of *method* in its parent class. + + Since this is used on :py:class:`~.StringMixIn`, the "parent class" used is + ``str``. This function can be used as a decorator. + """ + method.__doc__ = getattr(str, method.__name__).__doc__ + return method + class StringMixIn(object): """Implement the interface for ``unicode``/``str`` in a dynamic manner. @@ -99,8 +108,20 @@ class StringMixIn(object): def __contains__(self, item): return str(item) in self.__unicode__() + @inheritdoc + def encode(self, encoding=None, errors=None): + if encoding is None: + encoding = getdefaultencoding() + args = [encoding] + if errors is not None: + args.append(errors) + return self.__unicode__().encode(*args) + def __getattr__(self, attr): return getattr(self.__unicode__(), attr) if py3k: maketrans = str.maketrans # Static method can't rely on __getattr__ + + +del inheritdoc From ee194fb07a47f74de52c24f164a3487d0665dbb8 Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 12:43:25 +0100 Subject: [PATCH 2/9] Use a generator expression instead to support Python 2.6. --- mwparserfromhell/parser/tokenizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mwparserfromhell/parser/tokenizer.py b/mwparserfromhell/parser/tokenizer.py index 7ed4daf..b3ac543 100644 --- a/mwparserfromhell/parser/tokenizer.py +++ b/mwparserfromhell/parser/tokenizer.py @@ -620,7 +620,7 @@ class Tokenizer(object): self._emit_first(tokens.TagAttrStart(pad_first=buf["first"], pad_before_eq=buf["before_eq"], pad_after_eq=buf["after_eq"])) self._emit_all(self._pop()) - data.padding_buffer = {key: "" for key in data.padding_buffer} + data.padding_buffer = dict((key, "") for key in data.padding_buffer) def _handle_tag_space(self, data, text): """Handle whitespace (*text*) inside of an HTML open tag.""" From 3d1329aa3adf7368852db190d76e988af3cc80d9 Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 12:44:37 +0100 Subject: [PATCH 3/9] Don't assume it's a named tuple to support Python 2.6. --- mwparserfromhell/compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mwparserfromhell/compat.py b/mwparserfromhell/compat.py index 620fd15..1a40d31 100644 --- a/mwparserfromhell/compat.py +++ b/mwparserfromhell/compat.py @@ -10,8 +10,8 @@ types are meant to be imported directly from within the parser's modules. import sys -py3k = sys.version_info.major == 3 -py32 = py3k and sys.version_info.minor == 2 +py3k = (sys.version_info[0] == 3) +py32 = py3k and (sys.version_info[1] == 2) if py3k: bytes = bytes From 88c8fb88e0cd788949109a2d9d1d4b12e574f1d2 Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 12:46:26 +0100 Subject: [PATCH 4/9] Switch to `unittest2` to be able to use new features in Python 2.6. --- discover_tests.py | 23 +++++++++++++++++++++++ setup.py | 3 ++- tests/_test_tokenizer.py | 4 ++-- tests/_test_tree_equality.py | 2 +- tests/test_argument.py | 4 ++-- tests/test_attribute.py | 4 ++-- tests/test_builder.py | 4 ++-- tests/test_comment.py | 4 ++-- tests/test_ctokenizer.py | 8 ++++---- tests/test_docs.py | 6 +++--- tests/test_external_link.py | 4 ++-- tests/test_heading.py | 4 ++-- tests/test_html_entity.py | 4 ++-- tests/test_parameter.py | 4 ++-- tests/test_parser.py | 4 ++-- tests/test_pytokenizer.py | 6 +++--- tests/test_smart_list.py | 6 +++--- tests/test_string_mixin.py | 6 +++--- tests/test_tag.py | 4 ++-- tests/test_template.py | 4 ++-- tests/test_text.py | 6 +++--- tests/test_tokens.py | 6 +++--- tests/test_utils.py | 4 ++-- tests/test_wikicode.py | 4 ++-- tests/test_wikilink.py | 4 ++-- 25 files changed, 78 insertions(+), 54 deletions(-) create mode 100644 discover_tests.py diff --git a/discover_tests.py b/discover_tests.py new file mode 100644 index 0000000..5065aba --- /dev/null +++ b/discover_tests.py @@ -0,0 +1,23 @@ +# -*- coding: UTF-8 -*- + + +""" +Discover tests using ``unittest2`. + +It appears the default distutils test suite doesn't play nice with +``setUpClass`` thereby making some tests fail. Using ``unittest2`` +to load tests seems to work around that issue. + +http://stackoverflow.com/a/17004409/753501 +""" + + +# Standard: +import os + +# External: +import unittest2 + + +def additional_tests(): + return unittest2.defaultTestLoader.discover(os.path.dirname(__file__)) diff --git a/setup.py b/setup.py index 3718e68..1dcb7b2 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,8 @@ setup( name = "mwparserfromhell", packages = find_packages(exclude=("tests",)), ext_modules = [tokenizer], - test_suite = "tests", + tests_require = ['unittest2'], + test_suite = "discover_tests", version = __version__, author = "Ben Kurtovic", author_email = "ben.kurtovic@gmail.com", diff --git a/tests/_test_tokenizer.py b/tests/_test_tokenizer.py index 7487241..7f6bb52 100644 --- a/tests/_test_tokenizer.py +++ b/tests/_test_tokenizer.py @@ -35,7 +35,7 @@ class _TestParseError(Exception): class TokenizerTestCase(object): """A base test case for tokenizers, whose tests are loaded dynamically. - Subclassed along with unittest.TestCase to form TestPyTokenizer and + Subclassed along with unittest2.TestCase to form TestPyTokenizer and TestCTokenizer. Tests are loaded dynamically from files in the 'tokenizer' directory. """ @@ -121,7 +121,7 @@ class TokenizerTestCase(object): if len(sys.argv) > 2 and sys.argv[1] == "--use": for name in sys.argv[2:]: load_file(path.join(directory, name + extension)) - sys.argv = [sys.argv[0]] # So unittest doesn't try to load these + sys.argv = [sys.argv[0]] # So unittest2 doesn't try to load these cls.skip_others = True else: for filename in listdir(directory): diff --git a/tests/_test_tree_equality.py b/tests/_test_tree_equality.py index 25682a9..99003ac 100644 --- a/tests/_test_tree_equality.py +++ b/tests/_test_tree_equality.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -from unittest import TestCase +from unittest2 import TestCase from mwparserfromhell.compat import range from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity, diff --git a/tests/test_argument.py b/tests/test_argument.py index d58137e..48eca1a 100644 --- a/tests/test_argument.py +++ b/tests/test_argument.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Argument, Text @@ -99,4 +99,4 @@ class TestArgument(TreeEqualityTestCase): self.assertIs(None, node2.default) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_attribute.py b/tests/test_attribute.py index 4bb6643..4d22338 100644 --- a/tests/test_attribute.py +++ b/tests/test_attribute.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Template @@ -86,4 +86,4 @@ class TestAttribute(TreeEqualityTestCase): self.assertRaises(ValueError, setattr, node, pad, True) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_builder.py b/tests/test_builder.py index 26107a9..6a95f66 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.nodes import (Argument, Comment, ExternalLink, Heading, HTMLEntity, Tag, Template, Text, Wikilink) @@ -417,4 +417,4 @@ class TestBuilder(TreeEqualityTestCase): self.assertWikicodeEqual(valid, self.builder.build(test)) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_comment.py b/tests/test_comment.py index eb87e7e..784a4b3 100644 --- a/tests/test_comment.py +++ b/tests/test_comment.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Comment @@ -64,4 +64,4 @@ class TestComment(TreeEqualityTestCase): self.assertEqual("barfoo", node.contents) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_ctokenizer.py b/tests/test_ctokenizer.py index db79d8f..c20ef3a 100644 --- a/tests/test_ctokenizer.py +++ b/tests/test_ctokenizer.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 try: from mwparserfromhell.parser._tokenizer import CTokenizer @@ -30,8 +30,8 @@ except ImportError: from ._test_tokenizer import TokenizerTestCase -@unittest.skipUnless(CTokenizer, "C tokenizer not available") -class TestCTokenizer(TokenizerTestCase, unittest.TestCase): +@unittest2.skipUnless(CTokenizer, "C tokenizer not available") +class TestCTokenizer(TokenizerTestCase, unittest2.TestCase): """Test cases for the C tokenizer.""" @classmethod @@ -45,4 +45,4 @@ class TestCTokenizer(TokenizerTestCase, unittest.TestCase): self.assertTrue(CTokenizer().USES_C) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_docs.py b/tests/test_docs.py index 441132c..1a48cbc 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -22,14 +22,14 @@ from __future__ import print_function, unicode_literals import json -import unittest +import unittest2 import mwparserfromhell from mwparserfromhell.compat import py3k, str from .compat import StringIO, urlencode, urlopen -class TestDocs(unittest.TestCase): +class TestDocs(unittest2.TestCase): """Integration test cases for mwparserfromhell's documentation.""" def assertPrint(self, input, output): @@ -128,4 +128,4 @@ class TestDocs(unittest.TestCase): self.assertEqual(expected, actual) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_external_link.py b/tests/test_external_link.py index 0f82743..4fc0561 100644 --- a/tests/test_external_link.py +++ b/tests/test_external_link.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import ExternalLink, Text @@ -122,4 +122,4 @@ class TestExternalLink(TreeEqualityTestCase): self.assertEqual("http://example.com/", str(node2)) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_heading.py b/tests/test_heading.py index 59ca59e..fa69978 100644 --- a/tests/test_heading.py +++ b/tests/test_heading.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Heading, Text @@ -85,4 +85,4 @@ class TestHeading(TreeEqualityTestCase): self.assertRaises(ValueError, setattr, node, "level", False) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_html_entity.py b/tests/test_html_entity.py index 6bf1103..de4c274 100644 --- a/tests/test_html_entity.py +++ b/tests/test_html_entity.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import HTMLEntity @@ -165,4 +165,4 @@ class TestHTMLEntity(TreeEqualityTestCase): self.assertEqual("\U0001F648", node4.normalize()) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_parameter.py b/tests/test_parameter.py index 7345660..0cc1b0f 100644 --- a/tests/test_parameter.py +++ b/tests/test_parameter.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Text @@ -72,4 +72,4 @@ class TestParameter(TreeEqualityTestCase): self.assertFalse(node2.showkey) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_parser.py b/tests/test_parser.py index 59d57a2..071e2c7 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell import parser from mwparserfromhell.compat import range @@ -86,4 +86,4 @@ class TestParser(TreeEqualityTestCase): parser.use_c = restore if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_pytokenizer.py b/tests/test_pytokenizer.py index 48a0efc..147738d 100644 --- a/tests/test_pytokenizer.py +++ b/tests/test_pytokenizer.py @@ -21,13 +21,13 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.parser.tokenizer import Tokenizer from ._test_tokenizer import TokenizerTestCase -class TestPyTokenizer(TokenizerTestCase, unittest.TestCase): +class TestPyTokenizer(TokenizerTestCase, unittest2.TestCase): """Test cases for the Python tokenizer.""" @classmethod @@ -41,4 +41,4 @@ class TestPyTokenizer(TokenizerTestCase, unittest.TestCase): self.assertFalse(Tokenizer().USES_C) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_smart_list.py b/tests/test_smart_list.py index 374b312..5b96725 100644 --- a/tests/test_smart_list.py +++ b/tests/test_smart_list.py @@ -21,12 +21,12 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import py3k, range from mwparserfromhell.smart_list import SmartList, _ListProxy -class TestSmartList(unittest.TestCase): +class TestSmartList(unittest2.TestCase): """Test cases for the SmartList class and its child, _ListProxy.""" def _test_get_set_del_item(self, builder): @@ -387,4 +387,4 @@ class TestSmartList(unittest.TestCase): self.assertEqual([4, 3, 2, 1.9, 1.8], child2) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_string_mixin.py b/tests/test_string_mixin.py index d825d73..bcf1ae0 100644 --- a/tests/test_string_mixin.py +++ b/tests/test_string_mixin.py @@ -23,7 +23,7 @@ from __future__ import unicode_literals from sys import getdefaultencoding from types import GeneratorType -import unittest +import unittest2 from mwparserfromhell.compat import bytes, py3k, py32, range, str from mwparserfromhell.string_mixin import StringMixIn @@ -36,7 +36,7 @@ class _FakeString(StringMixIn): return self._data -class TestStringMixIn(unittest.TestCase): +class TestStringMixIn(unittest2.TestCase): """Test cases for the StringMixIn class.""" def test_docs(self): @@ -432,4 +432,4 @@ class TestStringMixIn(unittest.TestCase): self.assertEqual("000123", str12.zfill(6)) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_tag.py b/tests/test_tag.py index e7e1554..f9d0e87 100644 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Tag, Template, Text @@ -305,4 +305,4 @@ class TestTag(TreeEqualityTestCase): self.assertEqual('
', node) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_template.py b/tests/test_template.py index 6e1b09a..1d3a547 100644 --- a/tests/test_template.py +++ b/tests/test_template.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import HTMLEntity, Template, Text @@ -428,4 +428,4 @@ class TestTemplate(TreeEqualityTestCase): self.assertEqual("{{foo|a=b|c=d|e=f|a=|a=b}}", node26) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_text.py b/tests/test_text.py index 930152c..c9f89cc 100644 --- a/tests/test_text.py +++ b/tests/test_text.py @@ -21,12 +21,12 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Text -class TestText(unittest.TestCase): +class TestText(unittest2.TestCase): """Test cases for the Text node.""" def test_unicode(self): @@ -71,4 +71,4 @@ class TestText(unittest.TestCase): self.assertIsInstance(node.value, str) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_tokens.py b/tests/test_tokens.py index 6539675..cc2f366 100644 --- a/tests/test_tokens.py +++ b/tests/test_tokens.py @@ -21,12 +21,12 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import py3k from mwparserfromhell.parser import tokens -class TestTokens(unittest.TestCase): +class TestTokens(unittest2.TestCase): """Test cases for the Token class and its subclasses.""" def test_issubclass(self): @@ -105,4 +105,4 @@ class TestTokens(unittest.TestCase): self.assertEqual(token, eval(repr(token), vars(tokens))) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_utils.py b/tests/test_utils.py index 4512027..f62c1a2 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.nodes import Template, Text from mwparserfromhell.utils import parse_anything @@ -59,4 +59,4 @@ class TestUtils(TreeEqualityTestCase): self.assertRaises(ValueError, parse_anything, ["foo", [object]]) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_wikicode.py b/tests/test_wikicode.py index 38133d7..d7119ed 100644 --- a/tests/test_wikicode.py +++ b/tests/test_wikicode.py @@ -24,7 +24,7 @@ from __future__ import unicode_literals from functools import partial import re from types import GeneratorType -import unittest +import unittest2 from mwparserfromhell.compat import py3k, str from mwparserfromhell.nodes import (Argument, Comment, Heading, HTMLEntity, @@ -432,4 +432,4 @@ class TestWikicode(TreeEqualityTestCase): self.assertEqual(expected.expandtabs(4), code.get_tree()) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) diff --git a/tests/test_wikilink.py b/tests/test_wikilink.py index fc2abf4..425f1ec 100644 --- a/tests/test_wikilink.py +++ b/tests/test_wikilink.py @@ -21,7 +21,7 @@ # SOFTWARE. from __future__ import unicode_literals -import unittest +import unittest2 from mwparserfromhell.compat import str from mwparserfromhell.nodes import Text, Wikilink @@ -99,4 +99,4 @@ class TestWikilink(TreeEqualityTestCase): self.assertIs(None, node2.text) if __name__ == "__main__": - unittest.main(verbosity=2) + unittest2.main(verbosity=2) From 21830039978ca1c8988b837a5bc3510ba03ba072 Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 12:56:55 +0100 Subject: [PATCH 5/9] Python 2.6 is now supported. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1dcb7b2..066143c 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,9 @@ import sys -if (sys.version_info[0] == 2 and sys.version_info[1] < 7) or \ +if (sys.version_info[0] == 2 and sys.version_info[1] < 6) or \ (sys.version_info[1] == 3 and sys.version_info[1] < 2): - raise Exception('mwparserfromhell needs Python 2.7+ or 3.2+') + raise Exception('mwparserfromhell needs Python 2.6+ or 3.2+') from setuptools import setup, find_packages, Extension @@ -59,6 +59,7 @@ setup( "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", + "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", From e632d0dd44a727ab203e998768172931d34767be Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 13:11:59 +0100 Subject: [PATCH 6/9] Update Travis CI configuration to also test with Python 2.6. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 347badd..31090f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python python: + - "2.6" - "2.7" - "3.2" - "3.3" From cc026712068d0c9cc2e1dffbba0cc6453118a285 Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 13:12:29 +0100 Subject: [PATCH 7/9] Update changelog to mention support for Python 2.6. --- CHANGELOG | 1 + docs/changelog.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 558e5cb..84dc148 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ v0.4 (unreleased): +- Added support for Python 2.6. - Template.has() is now passed 'ignore_empty=False' by default instead of True. This fixes a bug when adding parameters to templates with empty fields, and is a breaking change if you rely on the default behavior. diff --git a/docs/changelog.rst b/docs/changelog.rst index 07b02da..ada6e1e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,6 +7,7 @@ v0.4 Unreleased (`changes `__): +- Added support for Python 2.6. - :py:meth:`.Template.has` is now passed *ignore_empty=False* by default instead of *True*. This fixes a bug when adding parameters to templates with empty fields, **and is a breaking change if you rely on the default From 19e6c186f3354abd6592f805a3bbc42018372a0a Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 13:37:50 +0100 Subject: [PATCH 8/9] Be explicit with the import. --- discover_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discover_tests.py b/discover_tests.py index 5065aba..3e8dbe9 100644 --- a/discover_tests.py +++ b/discover_tests.py @@ -13,7 +13,7 @@ http://stackoverflow.com/a/17004409/753501 # Standard: -import os +import os.path # External: import unittest2 From a65357a535e97f907a288a55c99ed06abed9701c Mon Sep 17 00:00:00 2001 From: Marcio Faustino Date: Thu, 27 Feb 2014 13:44:32 +0100 Subject: [PATCH 9/9] Correct dependency for Python 3. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 066143c..1e126fb 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( name = "mwparserfromhell", packages = find_packages(exclude=("tests",)), ext_modules = [tokenizer], - tests_require = ['unittest2'], + tests_require = ['unittest2py3k' if py3k else 'unittest2'], test_suite = "discover_tests", version = __version__, author = "Ben Kurtovic",