We have CentOS with the ancient Python 2.4 interpreter.
But we would like to write out tests with a newer 2.5/2.6 syntax.
Assuming we have a second Python interpreter installed (e.g. python2.6) is there any way to run the 'nosetests' shell command and tell it to use a specific python interpreter instead of the default one?
The Nose package can be imported by using import nose in the code, however this step is optional. If you are making use of specific modules in Nose, the same has to be imported using import Nose. <module_name> in the code.
pytest has basic support for running tests written for nose.
The nosetests file is in Python, so it should just be a matter of running it in your new version. Find where the file is:
which nosetests
Then:
python2.6 /usr/bin/nosetests
Adjusting the name and path to match your system. I've not tested, but that should work.
Well, what I'd do is to install a different version of Python (2.6 say) and then create a virtualenv and install nose inside that. It will then use that version of nose and keep your stuff isolated.
You can also consider using tox to try to bridge interpreters.
Finally, you can simply run nose python2.6 $(which nose) [other options] args
to run nose with the newer Python.
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