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.
This commit is contained in:
Samuel Dion-Girardeau 2016-08-12 18:38:33 -04:00
parent 20635bdec8
commit 00f6964a90
6 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,6 @@
language: python language: python
python: python:
- "2.6"
- "2.7" - "2.7"
- "3.3" - "3.3"
- "3.4" - "3.4"

View file

@ -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 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 your new functionality into a function with a docstring, and add the
feature to the list in README.rst. 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 `Travis`_ and make sure that
the tests pass for all supported Python versions. the tests pass for all supported Python versions.

View file

@ -33,7 +33,7 @@ Requirements
------------ ------------
* Redis. * Redis.
* Python 2.7 or 3.3+. * Python 2.6, 2.7 or 3.3+.
Installation Installation
------------ ------------

View file

@ -26,6 +26,7 @@ setup(
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',

View file

@ -58,8 +58,8 @@ class SnapPassRoutesTestCase(TestCase):
def test_show_password(self): def test_show_password(self):
password = "I like novelty kitten statues!" password = "I like novelty kitten statues!"
key = snappass.set_password(password, 30) key = snappass.set_password(password, 30)
rv = self.app.get('/{}'.format(key)) rv = self.app.get('/{0}'.format(key))
self.assertIn(password, rv.get_data(as_text=True)) self.assertTrue(password in rv.get_data(as_text=True))
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py27, py33, py34, py35 envlist = py26, py27, py33, py34, py35
[testenv] [testenv]
deps = deps =