From 8ba0cc8dc34967ae5625f5f177cec9f7b04fb407 Mon Sep 17 00:00:00 2001 From: Tal Einat Date: Fri, 28 Mar 2014 10:48:17 +0300 Subject: [PATCH] got tox to run 2to3 on tests before running them with Python 3.x --- tests/test_common.py | 6 ++---- tox.ini | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/test_common.py b/tests/test_common.py index 7805048..f977c18 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -35,18 +35,16 @@ class TestGroupMatches(unittest.TestCase): ) -import six - class TestSearchExact(unittest.TestCase): def search(self, sequence, subsequence): return list(search_exact(sequence, subsequence)) def test_bytes(self): - text = six.b('abc') + text = 'abc' self.assertEqual(self.search(text, text), [0]) def test_unicode(self): - text = six.u('abc') + text = u'abc' self.assertEqual(self.search(text, text), [0]) def test_biopython_Seq(self): diff --git a/tox.ini b/tox.ini index 5b2f0a7..47ca522 100644 --- a/tox.ini +++ b/tox.ini @@ -2,12 +2,13 @@ envlist = py26, py27, py31, py32, py33 [testenv] -setenv = - PYTHONPATH = {toxinidir}:{toxinidir}/searchtml commands = python setup.py test deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test_requirements.txt +whitelist_externals = + rm + 2to3 [testenv:py26] deps = @@ -22,17 +23,32 @@ deps = biopython [testenv:py31] +changedir = {toxworkdir} +commands = + 2to3 -n -W --output-dir {envtmpdir}/tests3 {toxinidir}/tests + {envpython} -m unittest2 discover {envtmpdir}/tests3 + rm -rf {envtmpdir}/tests3 deps = unittest2py3k mock {[testenv]deps} [testenv:py32] +changedir = {toxworkdir} +commands = + 2to3 -n -W --output-dir {envtmpdir}/tests3 {toxinidir}/tests + {envpython} -m unittest discover {envtmpdir}/tests3 + rm -rf {envtmpdir}/tests3 deps = mock {[testenv]deps} [testenv:py33] +changedir = {toxworkdir} +commands = + 2to3 -n -W --output-dir {envtmpdir}/tests3 {toxinidir}/tests + {envpython} -m unittest discover {envtmpdir}/tests3 + rm -rf {envtmpdir}/tests3 deps = {[testenv]deps} biopython