Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions python_files/tests/pytestadapter/.data/skip_test_fixture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import pytest


@pytest.fixture
def docker_client() -> object:
try:
# NOTE: Actually connect with the docker sdk
raise Exception("Docker client not available")
except Exception:
pytest.skip("Docker client not available")

return object()


def test_docker_client(docker_client):
assert False
13 changes: 13 additions & 0 deletions python_files/tests/pytestadapter/expected_execution_test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,16 @@
"subtest": None,
},
}

skip_test_fixture_path = TEST_DATA_PATH / "skip_test_fixture.py"
skip_test_fixture_execution_expected_output = {
get_absolute_test_id("skip_test_fixture.py::test_docker_client", skip_test_fixture_path): {
"test": get_absolute_test_id(
"skip_test_fixture.py::test_docker_client", skip_test_fixture_path
),
"outcome": "skipped",
"message": None,
"traceback": None,
"subtest": None,
}
}
5 changes: 5 additions & 0 deletions python_files/tests/pytestadapter/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ def test_rootdir_specified():
expected_execution_test_output.nested_describe_expected_execution_output,
id="nested_describe_plugin",
),
pytest.param(
["skip_test_fixture.py::test_docker_client"],
expected_execution_test_output.skip_test_fixture_execution_expected_output,
id="skip_test_fixture",
),
],
)
def test_pytest_execution(test_ids, expected_const):
Expand Down
2 changes: 1 addition & 1 deletion python_files/vscode_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def pytest_report_teststatus(report, config): # noqa: ARG001
if SYMLINK_PATH:
cwd = SYMLINK_PATH

if report.when == "call":
if report.when == "call" or (report.when == "setup" and report.skipped):
traceback = None
message = None
report_value = "skipped"
Expand Down
Loading