File tree Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Original file line number Diff line number Diff line change 11import 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
272273def 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
You can’t perform that action at this time.
0 commit comments