Skip to content

Commit 14142b9

Browse files
authored
tests: remove unnecessary test, clarify (#6013)
tests: remove unnecessary test, clarify
2 parents 16efa1b + 0123b29 commit 14142b9

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

testing/python/setup_only.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from _pytest.main import ExitCode
23

34

45
@pytest.fixture(params=["--setup-only", "--setup-plan", "--setup-show"], scope="module")
@@ -270,19 +271,17 @@ def test_arg(arg):
270271

271272

272273
def test_setup_show_with_KeyboardInterrupt_in_test(testdir):
273-
""" Verifies that setups are shown and tests are executed even if there was a KeyboardInterrupt in a test. """
274274
p = testdir.makepyfile(
275275
"""
276276
import pytest
277277
@pytest.fixture
278278
def arg():
279-
assert True
279+
pass
280280
def test_arg(arg):
281281
raise KeyboardInterrupt()
282282
"""
283283
)
284284
result = testdir.runpytest("--setup-show", p, no_reraise_ctrlc=True)
285-
assert result.ret == 2
286285
result.stdout.fnmatch_lines(
287286
[
288287
"*SETUP F arg*",
@@ -292,22 +291,4 @@ def test_arg(arg):
292291
"*= no tests ran in *",
293292
]
294293
)
295-
296-
297-
def test_setup_show_with_KeyboardInterrupt_in_fixture(testdir):
298-
""" Verifies that setups are shown and tests are executed even if there was a KeyboardInterrupt in a fixture. """
299-
p = testdir.makepyfile(
300-
"""
301-
import pytest
302-
@pytest.fixture
303-
def arg():
304-
raise KeyboardInterrupt()
305-
def test_arg(arg):
306-
assert True
307-
"""
308-
)
309-
result = testdir.runpytest("--setup-show", p, no_reraise_ctrlc=True)
310-
assert result.ret == 2
311-
result.stdout.fnmatch_lines(
312-
["*SETUP F arg*", "*! KeyboardInterrupt !*", "*= no tests ran in *"]
313-
)
294+
assert result.ret == ExitCode.INTERRUPTED

0 commit comments

Comments
 (0)