diff options
-rw-r--r-- | AUTHORS.txt | 1 | ||||
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | doc/cmd.rst | 12 |
3 files changed, 12 insertions, 3 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt index 0f921841..37acfa74 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -22,6 +22,7 @@ Sandra Martocchia Patrick Mezard Noel O'Boyle Detlev Offenbach +George Paci Catherine Proulx Brandon Rhodes Adi Roiban diff --git a/CHANGES.txt b/CHANGES.txt index 66bf5c85..75bf618a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,7 +6,7 @@ Version 3.5.2b1 --------------- - When running a module with ``coverage run -m <modulename>``, certain details - of the execution environment weren't the same as for + of the execution environment weren't the same as for ``python -m <modulename>``. This had the unfortunate side-effect of making ``coverage run -m unittest discover`` not work if you had tests in a directory named "test". This fixes `issue 155`_. diff --git a/doc/cmd.rst b/doc/cmd.rst index 302eb979..a9c00dcc 100644 --- a/doc/cmd.rst +++ b/doc/cmd.rst @@ -12,6 +12,7 @@ Coverage command line usage :history: 20100223T200600, changes for 3.3 :history: 20100725T211700, updated for 3.4 :history: 20110827T212500, updated for 3.5.1, combining aliases +:history: 20120119T075600, Added some clarification from George Paci .. highlight:: console @@ -69,14 +70,21 @@ Your program runs just as if it had been invoked with the Python command line. Arguments after your file name are passed to your program as usual in ``sys.argv``. Rather than providing a filename, you can use the ``-m`` switch and specify an importable module name instead, just as you can with the -Python ``-m`` switch. +Python ``-m`` switch:: + + $ coverage run -m packagename.modulename arg1 arg2 + blah blah ..your program's output.. blah blah If you want :ref:`branch coverage <branch>` measurement, use the ``--branch`` flag. Otherwise only statement coverage is measured. You can specify the code to measure with the ``--source``, ``--include``, and ``--omit`` switches. See :ref:`Specifying source files <source_execution>` for -more details. +details of their interpretation. Remember to put options for run after "run", +but before the program invocation:: + + $ coverage run --source=dir1,dir2 my_program.py arg1 arg2 + $ coverage run --source=dir1,dir2 -m packagename.modulename arg1 arg2 By default, coverage does not measure code installed with the Python interpreter, for example, the standard library. If you want to measure that |