diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-23 06:35:45 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-25 15:03:08 -0500 |
commit | c9d821deba6f7ee5eef30fef5355f7c93808b4f9 (patch) | |
tree | fb2d4d88de781e203d8beae8260e17380c5553f9 /tests/test_cmdline.py | |
parent | 97fdd550020384d2eedaf72ff0cd46a4efcb7d05 (diff) | |
download | python-coveragepy-git-c9d821deba6f7ee5eef30fef5355f7c93808b4f9.tar.gz |
feat: multiple --concurrency values. #1012 #1082nedbat/multi-concurrency
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r-- | tests/test_cmdline.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index ab4b9e20..42f313f8 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -610,7 +610,7 @@ class CmdLineTest(BaseCmdLineTest): cov.save() """) self.cmd_executes("run --concurrency=gevent foo.py", """\ - cov = Coverage(concurrency='gevent') + cov = Coverage(concurrency=['gevent']) runner = PyRunner(['foo.py'], as_module=False) runner.prepare() cov.start() @@ -619,7 +619,16 @@ class CmdLineTest(BaseCmdLineTest): cov.save() """) self.cmd_executes("run --concurrency=multiprocessing foo.py", """\ - cov = Coverage(concurrency='multiprocessing') + cov = Coverage(concurrency=['multiprocessing']) + runner = PyRunner(['foo.py'], as_module=False) + runner.prepare() + cov.start() + runner.run() + cov.stop() + cov.save() + """) + self.cmd_executes("run --concurrency=gevent,thread foo.py", """\ + cov = Coverage(concurrency=['gevent', 'thread']) runner = PyRunner(['foo.py'], as_module=False) runner.prepare() cov.start() @@ -627,19 +636,6 @@ class CmdLineTest(BaseCmdLineTest): cov.stop() cov.save() """) - - def test_bad_concurrency(self): - self.command_line("run --concurrency=nothing", ret=ERR) - err = self.stderr() - assert "option --concurrency: invalid choice: 'nothing'" in err - - def test_no_multiple_concurrency(self): - # You can't use multiple concurrency values on the command line. - # I would like to have a better message about not allowing multiple - # values for this option, but optparse is not that flexible. - self.command_line("run --concurrency=multiprocessing,gevent foo.py", ret=ERR) - err = self.stderr() - assert "option --concurrency: invalid choice: 'multiprocessing,gevent'" in err def test_multiprocessing_needs_config_file(self): # You can't use command-line args to add options to multiprocessing |