From 00f6964a90ae29a6de6bff8e3295d7e93ebb055c Mon Sep 17 00:00:00 2001 From: Samuel Dion-Girardeau Date: Fri, 12 Aug 2016 18:38:33 -0400 Subject: [PATCH] Fix python2.6 support for tests - "{}".format('foo') does not work on python2.6, as the index needs to be explicitly specified. - assertIn(x, y) was only introduced in 2.7, reverting to assertTrue(x in y) Updated test environments definitions and docs accordingly. --- .travis.yml | 1 + CONTRIBUTING.rst | 2 +- README.rst | 2 +- setup.py | 1 + tests.py | 4 ++-- tox.ini | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d0ad25a..e118237 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python python: + - "2.6" - "2.7" - "3.3" - "3.4" diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index c8299cd..20bf915 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -113,7 +113,7 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 2.7 and 3.3+. Check +3. The pull request should work for Python 2.6, 2.7 and 3.3+. Check `Travis`_ and make sure that the tests pass for all supported Python versions. diff --git a/README.rst b/README.rst index bb9eca7..e8dc2cf 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,7 @@ Requirements ------------ * Redis. -* Python 2.7 or 3.3+. +* Python 2.6, 2.7 or 3.3+. Installation ------------ diff --git a/setup.py b/setup.py index d0a1811..562b643 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ setup( 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', diff --git a/tests.py b/tests.py index 988961d..a90b292 100644 --- a/tests.py +++ b/tests.py @@ -58,8 +58,8 @@ class SnapPassRoutesTestCase(TestCase): def test_show_password(self): password = "I like novelty kitten statues!" key = snappass.set_password(password, 30) - rv = self.app.get('/{}'.format(key)) - self.assertIn(password, rv.get_data(as_text=True)) + rv = self.app.get('/{0}'.format(key)) + self.assertTrue(password in rv.get_data(as_text=True)) if __name__ == '__main__': diff --git a/tox.ini b/tox.ini index 0a9c5cd..d06412b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py33, py34, py35 +envlist = py26, py27, py33, py34, py35 [testenv] deps =