The usage of -m option of python
tjreedy at udel.edu
Tue Mar 19 04:03:15 CET 2013
On 3/18/2013 5:17 PM, Peng Yu wrote:
> I don't quite understand how -m option is used. And it is difficult to
> search for -m in google. Could anybody provide me with an example on
> how to use this option?
python -m test
at a command line runs the regression tests in the test package
python -m test -v test_difflib
runs test.test_difflib in verbose mode.
These are alternatives to
python <path-to-test> ...
Python just searches for module itself, same as for import, but executes
it as main module instead of importing.
This is really handy for developers running tests, where path-to-test is
not only a nuisance to type, but different for development builds than
for installations, and of course, different for each version. Let python
find the /Lib corresponding to the executable.
I am not sure if it works for things outside /Lib
Terry Jan Reedy
More information about the Python-list