Skip to content

Commit fd43b90

Browse files
committed
add test
1 parent 703d90f commit fd43b90

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
import pytest
5+
import os
6+
7+
@pytest.mark.flaky(reruns=2)
8+
def test_flaky(): # test_marker--test_flaky
9+
# count is not set for first run, but set to 2 for the second run
10+
count = os.environ.get("COUNT")
11+
os.environ["COUNT"] = "2"
12+
# this will fail on the first run, but pass on the second (1 passed, 1 rerun)
13+
assert count == "2"

python_files/tests/pytestadapter/expected_execution_test_output.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,3 +734,18 @@
734734
"subtest": None,
735735
},
736736
}
737+
738+
test_rerunfailures_plugin_path = TEST_DATA_PATH / "test_rerunfailures_plugin.py"
739+
rerunfailures_plugin_expected_execution_output = {
740+
get_absolute_test_id(
741+
"test_rerunfailures_plugin.py::test_flaky", test_rerunfailures_plugin_path
742+
): {
743+
"test": get_absolute_test_id(
744+
"test_rerunfailures_plugin.py::test_flaky", test_rerunfailures_plugin_path
745+
),
746+
"outcome": "success",
747+
"message": None,
748+
"traceback": None,
749+
"subtest": None,
750+
}
751+
}

python_files/tests/pytestadapter/test_execution.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ def test_rootdir_specified():
194194
expected_execution_test_output.nested_describe_expected_execution_output,
195195
id="nested_describe_plugin",
196196
),
197+
pytest.param(
198+
[
199+
"test_rerunfailures_plugin.py::test_flaky",
200+
],
201+
expected_execution_test_output.rerunfailures_plugin_expected_execution_output,
202+
id="test_rerunfailures_plugin",
203+
),
197204
],
198205
)
199206
def test_pytest_execution(test_ids, expected_const):

python_files/vscode_pytest/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@
3333
USES_PYTEST_DESCRIBE = True
3434

3535

36-
sys.path.append("/Users/eleanorboyd/vscode-python/.nox/install_python_libs/lib/python3.10")
37-
sys.path.append("/Users/eleanorboyd/vscode-python-debugger")
38-
sys.path.append("/Users/eleanorboyd/vscode-python-debugger/bundled")
39-
sys.path.append("/Users/eleanorboyd/vscode-python-debugger/bundled/libs")
40-
41-
import debugpy # noqa: E402
42-
43-
debugpy.connect(5678)
44-
debugpy.breakpoint() # noqa: E702
45-
4636

4737
class TestData(TypedDict):
4838
"""A general class that all test objects inherit from."""

0 commit comments

Comments
 (0)