April 2015
Intermediate to advanced
264 pages
5h 31m
English
Throughout the book, we have used the following syntax to run our tests:
python.exe -m unittest
The ability to directly run a module with the -m flag was only introduced with Python 2.7. This syntax will not work if we are using an older version of Python. Instead, the unittest2 module from PyPi contains a unit2 script that mimics this behavior. The command line parameters remain the same, so we get the following the command:
python3 -m unittest discover -s stock_alerter -t .
And the above command now becomes:
unit2 discover -s stock_alerter -t .
If we use a build tool, it becomes fairly simple to check the version of Python and execute the appropriate command, thereby allowing the developer to run the tests in ...
Read now
Unlock full access