Skip to content

Commit

Permalink
pytest: report skipped tests due to empty fork intersection if -vv
Browse files Browse the repository at this point in the history
  • Loading branch information
danceratopz committed Jul 12, 2023
1 parent 889b181 commit 37845f5
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/pytest_plugins/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,27 @@ def pytest_generate_tests(metafunc):

if "fork" in metafunc.fixturenames:
if not intersection_range:
pytest.skip( # this reason is not reported on the command-line
f"{test_name} is not valid for any any of forks specified on the command-line."
)
if metafunc.config.getoption("verbose") >= 2:
pytest_params = [
pytest.param(
None,
marks=[
pytest.mark.skip(
reason=(
f"{test_name} is not valid for any any of forks specified on "
"the command-line."
)
)
],
)
]
metafunc.parametrize("fork", pytest_params, scope="function")
else:
# This will not be reported in the test execution output; it will be listed
# in the pytest collection summary at the start of the test run.
pytest.skip(
f"{test_name} is not valid for any any of forks specified on the command-line."
)
else:
pytest_params = [
pytest.param(
Expand Down

0 comments on commit 37845f5

Please sign in to comment.