Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove usage of pytest CollectReport in rewrite #21859

Merged
merged 2 commits into from
Aug 21, 2023
Merged
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
24 changes: 10 additions & 14 deletions pythonFiles/vscode_pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ def __init__(self, message):


ERRORS = []
IS_DISCOVERY = False
map_id_to_path = dict()
collected_tests_so_far = list()


def pytest_load_initial_conftests(early_config, parser, args):
if "--collect-only" in args:
global IS_DISCOVERY
IS_DISCOVERY = True


def pytest_internalerror(excrepr, excinfo):
Expand All @@ -70,7 +79,7 @@ def pytest_exception_interact(node, call, report):
# call.excinfo is the captured exception of the call, if it raised as type ExceptionInfo.
# call.excinfo.exconly() returns the exception as a string.
# If it is during discovery, then add the error to error logs.
if type(report) == pytest.CollectReport:
if IS_DISCOVERY:
if call.excinfo and call.excinfo.typename != "AssertionError":
if report.outcome == "skipped" and "SkipTest" in str(call):
return
Expand Down Expand Up @@ -168,19 +177,6 @@ class testRunResultDict(Dict[str, Dict[str, TestOutcome]]):
tests: Dict[str, TestOutcome]


IS_DISCOVERY = False
map_id_to_path = dict()


def pytest_load_initial_conftests(early_config, parser, args):
if "--collect-only" in args:
global IS_DISCOVERY
IS_DISCOVERY = True


collected_tests_so_far = list()


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