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 1
1
import pytest
2
+ from _pytest .main import ExitCode
2
3
3
4
4
5
@pytest .fixture (params = ["--setup-only" , "--setup-plan" , "--setup-show" ], scope = "module" )
@@ -270,19 +271,17 @@ def test_arg(arg):
270
271
271
272
272
273
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. """
274
274
p = testdir .makepyfile (
275
275
"""
276
276
import pytest
277
277
@pytest.fixture
278
278
def arg():
279
- assert True
279
+ pass
280
280
def test_arg(arg):
281
281
raise KeyboardInterrupt()
282
282
"""
283
283
)
284
284
result = testdir .runpytest ("--setup-show" , p , no_reraise_ctrlc = True )
285
- assert result .ret == 2
286
285
result .stdout .fnmatch_lines (
287
286
[
288
287
"*SETUP F arg*" ,
@@ -292,22 +291,4 @@ def test_arg(arg):
292
291
"*= no tests ran in *" ,
293
292
]
294
293
)
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