summaryrefslogtreecommitdiff
path: root/tests/coveragetest.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-03-08 21:06:01 -0500
committerNed Batchelder <ned@nedbatchelder.com>2017-03-08 21:06:01 -0500
commitd5e1530109dbb15844d5afde523653eea12c94bb (patch)
tree053e656509b80749f21cb8c8a99b2b970ffbaedc /tests/coveragetest.py
parentc898faec0039f0761ac0c29bd8b4d3c0eb3f7575 (diff)
downloadpython-coveragepy-git-d5e1530109dbb15844d5afde523653eea12c94bb.tar.gz
Refactor command_line into a function.
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r--tests/coveragetest.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index cacd4362..f3491965 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -353,8 +353,7 @@ class CoverageTest(
Returns None.
"""
- script = CoverageScript(_covpkg=_covpkg)
- ret_actual = script.command_line(shlex.split(args))
+ ret_actual = command_line(args, _covpkg=_covpkg)
self.assertEqual(ret_actual, ret)
coverage_command = "coverage"
@@ -485,3 +484,16 @@ class DebugControlString(DebugControl):
def get_output(self):
"""Get the output text from the `DebugControl`."""
return self.output.getvalue()
+
+
+def command_line(args, **kwargs):
+ """Run `args` through the CoverageScript command line.
+
+ `kwargs` are the keyword arguments to the CoverageScript constructor.
+
+ Returns the return code from CoverageScript.command_line.
+
+ """
+ script = CoverageScript(**kwargs)
+ ret = script.command_line(shlex.split(args))
+ return ret