Skip to content

Commit dacea2d

Browse files
committed
refactor(test): simplify these tests
1 parent 5f29141 commit dacea2d

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

tests/test_concurrency.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -352,29 +352,21 @@ def gwork(q):
352352
assert re.search(r"TOTAL \d+ 0 100%", last_line)
353353

354354
def test_bad_concurrency(self):
355-
self.make_file("prog.py", "a = 1")
356-
msg = "Unknown concurrency choices: nothing"
357-
with pytest.raises(ConfigError, match=msg):
355+
with pytest.raises(ConfigError, match="Unknown concurrency choices: nothing"):
358356
self.command_line("run --concurrency=nothing prog.py")
359357

360358
def test_bad_concurrency_in_config(self):
361-
self.make_file("prog.py", "a = 1")
362359
self.make_file(".coveragerc", "[run]\nconcurrency = nothing\n")
363-
msg = "Unknown concurrency choices: nothing"
364-
with pytest.raises(ConfigError, match=msg):
360+
with pytest.raises(ConfigError, match="Unknown concurrency choices: nothing"):
365361
self.command_line("run prog.py")
366362

367363
def test_no_multiple_light_concurrency(self):
368-
self.make_file("prog.py", "a = 1")
369-
msg = "Conflicting concurrency settings: eventlet, gevent"
370-
with pytest.raises(ConfigError, match=msg):
364+
with pytest.raises(ConfigError, match="Conflicting concurrency settings: eventlet, gevent"):
371365
self.command_line("run --concurrency=gevent,eventlet prog.py")
372366

373367
def test_no_multiple_light_concurrency_in_config(self):
374-
self.make_file("prog.py", "a = 1")
375368
self.make_file(".coveragerc", "[run]\nconcurrency = gevent, eventlet\n")
376-
msg = "Conflicting concurrency settings: eventlet, gevent"
377-
with pytest.raises(ConfigError, match=msg):
369+
with pytest.raises(ConfigError, match="Conflicting concurrency settings: eventlet, gevent"):
378370
self.command_line("run prog.py")
379371

380372

0 commit comments

Comments
 (0)