diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-02-06 23:02:12 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-02-06 23:02:12 -0500 |
commit | ef9729d54c9c8b0a0e81affabfaa5ce396931b67 (patch) | |
tree | abf10fd31f3e06f16251ea68a1ec2bae3795e17a /test/test_cmdline.py | |
parent | 8b36ef4ddc2d5e44ff37b7e2c86f9a406860fe15 (diff) | |
download | python-coveragepy-ef9729d54c9c8b0a0e81affabfaa5ce396931b67.tar.gz |
Add tests and doc for Brandon's -m flag.
Diffstat (limited to 'test/test_cmdline.py')
-rw-r--r-- | test/test_cmdline.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py index a9858d5..d4cc763 100644 --- a/test/test_cmdline.py +++ b/test/test_cmdline.py @@ -33,7 +33,8 @@ class CmdLineTest(CoverageTest): """ m = self.model_object() ret = coverage.CoverageScript( - _covpkg=m, _run_python_file=m.run_python_file, _help_fn=m.help_fn + _covpkg=m, _run_python_file=m.run_python_file, + _run_python_module=m.run_python_module, _help_fn=m.help_fn ).command_line(shlex.split(args)) return m, ret @@ -521,6 +522,33 @@ class NewCmdLineTest(CmdLineTest): .save() """) + def test_run_module(self): + self.cmd_executes("run -m mymodule", """\ + .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, source=None, include=None, omit=None) + .erase() + .start() + .run_python_module('mymodule', ['mymodule']) + .stop() + .save() + """) + self.cmd_executes("run -m mymodule -qq arg1 arg2", """\ + .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=None, config_file=True, source=None, include=None, omit=None) + .erase() + .start() + .run_python_module('mymodule', ['mymodule', '-qq', 'arg1', 'arg2']) + .stop() + .save() + """) + self.cmd_executes("run --branch -m mymodule", """\ + .coverage(cover_pylib=None, data_suffix=None, timid=None, branch=True, config_file=True, source=None, include=None, omit=None) + .erase() + .start() + .run_python_module('mymodule', ['mymodule']) + .stop() + .save() + """) + self.cmd_executes_same("run -m mymodule", "run --module mymodule") + def test_xml(self): # coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...] self.cmd_executes("xml", self.INIT_LOAD + """\ |