From 2c5b877166c44249fca8427a646bd9cddba532e1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 13 Apr 2017 21:54:12 -0400 Subject: Print command-line errors to stderr instead of stdout --- tests/test_cmdline.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 000bf46c..30fb06ee 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -462,16 +462,16 @@ class CmdLineTest(BaseCmdLineTest): def test_bad_concurrency(self): self.command_line("run --concurrency=nothing", ret=ERR) - out = self.stdout() - self.assertIn("option --concurrency: invalid choice: 'nothing'", out) + err = self.stderr() + self.assertIn("option --concurrency: invalid choice: 'nothing'", 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) - out = self.stdout() - self.assertIn("option --concurrency: invalid choice: 'multiprocessing,gevent'", out) + err = self.stderr() + self.assertIn("option --concurrency: invalid choice: 'multiprocessing,gevent'", err) def test_multiprocessing_needs_config_file(self): # You can't use command-line args to add options to multiprocessing @@ -480,7 +480,7 @@ class CmdLineTest(BaseCmdLineTest): self.command_line("run --concurrency=multiprocessing --branch foo.py", ret=ERR) self.assertIn( "Options affecting multiprocessing must be specified in a configuration file.", - self.stdout() + self.stderr() ) def test_run_debug(self): @@ -530,11 +530,11 @@ class CmdLineTest(BaseCmdLineTest): def test_run_nothing(self): self.command_line("run", ret=ERR) - self.assertIn("Nothing to do", self.stdout()) + self.assertIn("Nothing to do", self.stderr()) def test_cant_append_parallel(self): self.command_line("run --append --parallel-mode foo.py", ret=ERR) - self.assertIn("Can't append to data files in parallel mode.", self.stdout()) + self.assertIn("Can't append to data files in parallel mode.", self.stderr()) def test_xml(self): # coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...] @@ -662,9 +662,9 @@ class CmdLineStdoutTest(BaseCmdLineTest): def test_error(self): self.command_line("fooey kablooey", ret=ERR) - out = self.stdout() - self.assertIn("fooey", out) - self.assertIn("help", out) + err = self.stderr() + self.assertIn("fooey", err) + self.assertIn("help", err) class CmdMainTest(CoverageTest): -- cgit v1.2.1