Skip to content

Commit

Permalink
tests: remove unnecessary test, clarify
Browse files Browse the repository at this point in the history
Follow-up to pytest-dev#6009.
  • Loading branch information
blueyed committed Oct 20, 2019
1 parent 16efa1b commit 0123b29
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions testing/python/setup_only.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from _pytest.main import ExitCode


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


def test_setup_show_with_KeyboardInterrupt_in_test(testdir):
""" Verifies that setups are shown and tests are executed even if there was a KeyboardInterrupt in a test. """
p = testdir.makepyfile(
"""
import pytest
@pytest.fixture
def arg():
assert True
pass
def test_arg(arg):
raise KeyboardInterrupt()
"""
)
result = testdir.runpytest("--setup-show", p, no_reraise_ctrlc=True)
assert result.ret == 2
result.stdout.fnmatch_lines(
[
"*SETUP F arg*",
Expand All @@ -292,22 +291,4 @@ def test_arg(arg):
"*= no tests ran in *",
]
)


def test_setup_show_with_KeyboardInterrupt_in_fixture(testdir):
""" Verifies that setups are shown and tests are executed even if there was a KeyboardInterrupt in a fixture. """
p = testdir.makepyfile(
"""
import pytest
@pytest.fixture
def arg():
raise KeyboardInterrupt()
def test_arg(arg):
assert True
"""
)
result = testdir.runpytest("--setup-show", p, no_reraise_ctrlc=True)
assert result.ret == 2
result.stdout.fnmatch_lines(
["*SETUP F arg*", "*! KeyboardInterrupt !*", "*= no tests ran in *"]
)
assert result.ret == ExitCode.INTERRUPTED

0 comments on commit 0123b29

Please sign in to comment.