From 4713ca78ba4d627644e91c1b7284e967bd7312cd Mon Sep 17 00:00:00 2001 From: Takayuki Shimizukawa Date: Tue, 1 May 2012 15:21:12 +0900 Subject: [PATCH] fix some testing. * Python3 test support * Specify depended library version for Python2.4, 2.5 --- tests/run.py | 15 ++++++++++----- tox.ini | 11 +++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/run.py b/tests/run.py index ee63fa3f09..8b3bf844d0 100755 --- a/tests/run.py +++ b/tests/run.py @@ -11,19 +11,24 @@ """ import sys -from os import path, chdir, listdir +from os import path, chdir, listdir, environ if sys.version_info >= (3, 0): print('Copying and converting sources to build/lib/tests...') from distutils.util import copydir_run_2to3 testroot = path.dirname(__file__) or '.' - newroot = path.join(testroot, path.pardir, 'build') - newroot = path.join(newroot, listdir(newroot)[0], 'tests') + if 'BUILD_TEST_PATH' in environ: + # for tox test. + newroot = environ['BUILD_TEST_PATH'] + # tox install sphinx package, not need sys.path.insert. + else: + newroot = path.join(testroot, path.pardir, 'build') + newroot = path.join(newroot, listdir(newroot)[0], 'tests') + # always test the sphinx package from build/lib/ + sys.path.insert(0, path.join(newroot, path.pardir)) copydir_run_2to3(testroot, newroot) # switch to the converted dir so nose tests the right tests chdir(newroot) - # always test the sphinx package from build/lib/ - sys.path.insert(0, path.pardir) else: # always test the sphinx package from this directory sys.path.insert(0, path.join(path.dirname(__file__), path.pardir)) diff --git a/tox.ini b/tox.ini index 15e36aae31..ef61bdef2b 100644 --- a/tox.ini +++ b/tox.ini @@ -4,14 +4,21 @@ envlist=py24,py25,py26,py27,py31,py32,pypy,du08,du07,du06,du05 [testenv] deps= nose +setenv = + BUILD_TEST_PATH = {envdir}/tests commands= - nosetests + {envpython} tests/run.py {posargs} sphinx-build -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html [testenv:py24] deps= nose - simplejson + simplejson==2.1.0 + +[testenv:py25] +deps= + nose + simplejson==2.5.0 [testenv:pypy] deps=