Skip to content

Commit

Permalink
add hookwrappers to pytest plugin to ensure run (#22240)
Browse files Browse the repository at this point in the history
fixes #22232. From
[this
discussion](pytest-dev/pytest#11509),
learned that some pytest hooks are meant to be unique and only one will
be called per run. If multiple plugins are at play then another plugin
the user has might override our plugin. Added the hookwrapper so our is
always run.
  • Loading branch information
eleanorjboyd authored Oct 17, 2023
1 parent 754f8ef commit 44053a2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pythonFiles/vscode_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class testRunResultDict(Dict[str, Dict[str, TestOutcome]]):
tests: Dict[str, TestOutcome]


@pytest.hookimpl(hookwrapper=True, trylast=True)
def pytest_report_teststatus(report, config):
"""
A pytest hook that is called when a test is called. It is called 3 times per test,
Expand Down Expand Up @@ -223,6 +224,7 @@ def pytest_report_teststatus(report, config):
"success",
collected_test if collected_test else None,
)
yield


ERROR_MESSAGE_CONST = {
Expand Down

0 comments on commit 44053a2

Please sign in to comment.