From dacea2d09a383db32bb4620a987076b02fe009f8 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 9 Feb 2022 06:06:06 -0500 Subject: [PATCH] refactor(test): simplify these tests --- tests/test_concurrency.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 1e919e3b6..5665e37f5 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -352,29 +352,21 @@ def gwork(q): assert re.search(r"TOTAL \d+ 0 100%", last_line) def test_bad_concurrency(self): - self.make_file("prog.py", "a = 1") - msg = "Unknown concurrency choices: nothing" - with pytest.raises(ConfigError, match=msg): + with pytest.raises(ConfigError, match="Unknown concurrency choices: nothing"): self.command_line("run --concurrency=nothing prog.py") def test_bad_concurrency_in_config(self): - self.make_file("prog.py", "a = 1") self.make_file(".coveragerc", "[run]\nconcurrency = nothing\n") - msg = "Unknown concurrency choices: nothing" - with pytest.raises(ConfigError, match=msg): + with pytest.raises(ConfigError, match="Unknown concurrency choices: nothing"): self.command_line("run prog.py") def test_no_multiple_light_concurrency(self): - self.make_file("prog.py", "a = 1") - msg = "Conflicting concurrency settings: eventlet, gevent" - with pytest.raises(ConfigError, match=msg): + with pytest.raises(ConfigError, match="Conflicting concurrency settings: eventlet, gevent"): self.command_line("run --concurrency=gevent,eventlet prog.py") def test_no_multiple_light_concurrency_in_config(self): - self.make_file("prog.py", "a = 1") self.make_file(".coveragerc", "[run]\nconcurrency = gevent, eventlet\n") - msg = "Conflicting concurrency settings: eventlet, gevent" - with pytest.raises(ConfigError, match=msg): + with pytest.raises(ConfigError, match="Conflicting concurrency settings: eventlet, gevent"): self.command_line("run prog.py")