still works as before, only that now it requires tox to be available in the /home/clupo/.pyenv/plugins/pyenv-virtualenv/shims:/home/clupo/.pyenv/shims:/home/clupo/.pyenv/bin:/home/clupo/.pyenv/plugins/pyenv-virtualenv/bin:/home/clupo/.local/bin:/home/clupo/bin:/home/clupo/.cargo/bin:/home/clupo/Applications/node-v6.11.4-linux-x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin, else it will fail
To run tox on specific versions of python, you can use the -e option:
$ tox -e py27
$ tox -e py35
To only run tests which match the given substring expression, use
py.test -k option. Do `py.test -h` for more info.
This way test discovery will work not only with the current unittest and doctest modules, but also with pytest's own kind of tests.
When run with no argument, the shell script will call the py.test command, which will scan the whole Lib/fontTools directory for all relevant tests.
If args are provided, tests are filtered if any of the substrings specified
match. The filtering works not only on the modules' file names (as the previous grep approach), but also on the names of the test functions, classes and methods. Pretty cool, huh?
We can still specify whether to run pytest with python -2 or -3 (provided pytest is installed on both Python versions).
And we don't need to print the python version any more as pytest does it for us.
Finally, there's no need to export PYTHONPATH -- pytest takes care of that too!
The first arg to run-tests.sh is used as a regex to narrow down
tests to run. We should extend this to consider all args as
regexes.
Eg:
./run-tests.sh xml
The Python libraries come with two ways of writing unittests:
module unittest, and module doctest. In some cases, unittest
is more natural (less cumbersome) than doctest.
Wrote tests on xmlWriter for illustration.