summaryrefslogtreecommitdiff
path: root/test/test_cmdline.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_cmdline.py')
-rw-r--r--test/test_cmdline.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py
index a9858d51..d4cc763d 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 + """\