I have a project that has both python2 and python3 code in it (its a client/server thing; the server is python3 but there are python2 and python3 clients). I'm using nose to handle unit testing. The directory layout is (currently) basically like
client2
tests
client3
tests
server
tests
Is there a way to set up or use nose so that running node with python2 gets just the python2 tests, and similarly python3. For instance, something like:
client2
tests2
client3
tests3
server
tests3
... with some suitable nose arguments. I messed around with the -m option but couldn't get anywhere.
Looks like you will need a combo of --where
and --py3where
:
--py3where:
Look for tests in this directory under Python 3.x. Functions the same as 'where', but only applies if running under Python 3.x or above. Note that, if present under 3.x, this option completely replaces any directories specified with 'where', so the 'where' option becomes ineffective. [NOSE_PY3WHERE]
So for you it would be something like this:
nosetests --where=. --where=client2 --py3where=. --py3where=client3 --py3where=server -v
When using nosetests with python3 it will run client3
and server
tests only. When running on python2 it will run client2
tests only.
Also, have a look at this question and answers for alternatives.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.