I've been trying to implement a single-source testing system that allows automated testing across multiple Python versions using tox + nosetests.
Problem is, I can't get it working whenever I test against Python 3.2. Everything works fine if I exclude Python 3.2.
Here's my tox.ini
:
[tox]
envlist = py25,py26,py27,py32,pypy,jython
[testenv]
commands =
nosetests []
deps =
nose
mock
[testenv:py32]
commands =
nosetests []
and my ~/.noserc
:
[nosetests]
verbosity=2
with-doctest=1
I've set the use_2to3
flag to True
in my setup.py, but this error keeps showing up: NameError: global name 'basestring' is not defined
. It seems that I'm missing some setting that should make 2to3
work, but I don't know what it is.
Additionally, I've tried replacing nosetests []
with python setup.py test
in the testenv:py32
setting. Unfortunately, not only the same error keeps showing up, it also introduces another error: Error in atexit._run_exitfuncs: TypeError: 'NoneType' object is not callable
.
Any pointers?
EDIT: added the code in setup.py
, in case it's useful:
# handle python 3
if sys.version_info >= (3,):
use_2to3 = True
else:
use_2to3 = False
and somewhere in setup()
: use_2to3 = use_2to3
You might use something like this in the [testenv]
section:
changedir = {envtmpdir}
commands = nosetests package # "package" is import name of the package under test
or if you have tests in a separate directory than the package:
changedir = tests # directory where tests are living
commands = nosetests []
This should prevent nose from picking up the wrong package version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With