-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Diagnostic Data
- Python version (& distribution if applicable, e.g., Anaconda): 3.13
- Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): venv
- Operating system (and version): Windows 11 Enterprise 10.0.26200
- Version of tool extension you are using: 2025.2.0
Behaviour
Expected Behavior
No notifications during normal use.
Actual Behavior
Repeated 'Skipping standard library file (stdlib excluded)' notifications with a path pointing to site-packages.
Reproduction Steps:
I don't think I've done anything special, I have a venv (created using python -m venv <path>) activated and write code. The latest notification that showed up today was for monkeypatch, so maybe writing a pytest test using monkeypatch. Importantly, I did not open any file in site-packages.
Logs:
Unfortunately the logs include sensitive client information. I have included a redacted version (mostly removing filenames/paths).
Click here for detailed logs
2025-12-02 12:04:43.949 [info] [Trace - 12:04:43 PM] Sending request 'textDocument/codeAction - (1451)'. 2025-12-02 12:04:43.949 [info] Params: { "textDocument": { "uri": "--redacted--" }, "range": { "start": { "line": 32, "character": 0 }, "end": { "line": 40, "character": 0 } }, "context": { "diagnostics": [], "triggerKind": 2 } }2025-12-02 12:04:43.952 [info] [Trace - 12:04:43 PM] Received response 'textDocument/codeAction - (1451)' in 3ms.
2025-12-02 12:04:43.952 [info] Result: []
2025-12-02 12:04:45.241 [info] [Trace - 12:04:45 PM] Sending notification 'textDocument/didChange'.
2025-12-02 12:04:45.241 [info] Params: {
"textDocument": {
"uri": "--redacted--",
"version": 3281
},
"contentChanges": [
{
"range": {
"start": {
"line": 32,
"character": 0
},
"end": {
"line": 40,
"character": 0
}
},
"rangeLength": 199,
"text": ""
}
]
}
2025-12-02 12:04:47.077 [info] [Trace - 12:04:47 PM] Sending notification 'textDocument/didOpen'.
2025-12-02 12:04:47.077 [info] Params: {
"textDocument": {
"uri": "file:///c%3A/--venv path--/Lib/site-packages/pytest_bdd/steps.py",
"languageId": "python",
"version": 1,
"text": """"Step decorators.\n\nExample:\n\n@given("I have an article", target_fixture="article")\ndef (author):\n return create_test_article(author=author)\n\n\n@when("I go to the article page")\ndef (browser, article):\n browser.visit(urljoin(browser.url, "/articles/{0}/".format(article.id)))\n\n\n@then("I should not see the error message")\ndef (browser):\n with pytest.raises(ElementDoesNotExist):\n browser.find_by_css(".message.error").first\n\n\nMultiple names for the steps:\n\n@given("I have an article")\n@given("there is an article")\ndef (author):\n return create_test_article(author=author)\n\n\nReusing existing fixtures for a different step name:\n\n\n@given("I have a beautiful article")\ndef (article):\n pass\n\n"""\n\nfrom future import annotations\n\nimport enum\nfrom collections.abc import Iterable\nfrom dataclasses import dataclass, field\nfrom itertools import count\nfrom typing import Any, Callable, Literal, TypeVar\n\nimport pytest\nfrom typing_extensions import ParamSpec\n\nfrom .parser import Step\nfrom .parsers import StepParser, get_parser\nfrom .types import GIVEN, THEN, WHEN\nfrom .utils import get_caller_module_locals\n\nP = ParamSpec("P")\nT = TypeVar("T")\n\n\n@enum.unique\nclass StepNamePrefix(enum.Enum):\n step_def = "pytestbdd_stepdef"\n step_impl = "pytestbdd_stepimpl"\n\n\n@dataclass\nclass StepFunctionContext:\n type: Literal["given", "when", "then"] | None\n step_func: Callable[..., Any]\n parser: StepParser\n converters: dict[str, Callable[[str], Any]] = field(default_factory=dict)\n target_fixture: str | None = None\n\n\ndef get_step_fixture_name(step: Step) -> str:\n """Get step fixture name"""\n return f"{StepNamePrefix.step_impl.value}{step.type}{step.name}"\n\n\ndef given(\n name: str | StepParser,\n converters: dict[str, Callable[[str], Any]] | None = None,\n target_fixture: str | None = None,\n stacklevel: int = 1,\n) -> Callable[[Callable[P, T]], Callable[P, T]]:\n """Given step decorator.\n\n :param name: Step name or a parser object.\n :param converters: Optional dict of the argument or parameter converters in form\n {<param_name>: }.\n :param target_fixture: Target fixture name to replace by steps definition function.\n :param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.\n\n :return: Decorator function for the step.\n """\n return step(name, GIVEN, converters=converters, target_fixture=target_fixture, stacklevel=stacklevel)\n\n\ndef when(\n name: str | StepParser,\n converters: dict[str, Callable[[str], Any]] | None = None,\n target_fixture: str | None = None,\n stacklevel: int = 1,\n) -> Callable[[Callable[P, T]], Callable[P, T]]:\n """When step decorator.\n\n :param name: Step name or a parser object.\n :param converters: Optional dict of the argument or parameter converters in form\n {<param_name>: }.\n :param target_fixture: Target fixture name to replace by steps definition function.\n :param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.\n\n :return: Decorator function for the step.\n """\n return step(name, WHEN, converters=converters, target_fixture=target_fixture, stacklevel=stacklevel)\n\n\ndef then(\n name: str | StepParser,\n converters: dict[str, Callable[[str], Any]] | None = None,\n target_fixture: str | None = None,\n stacklevel: int = 1,\n) -> Callable[[Callable[P, T]], Callable[P, T]]:\n """Then step decorator.\n\n :param name: Step name or a parser object.\n :param converters: Optional dict of the argument or parameter converters in form\n {<param_name>: }.\n :param target_fixture: Target fixture name to replace by steps definition function.\n :param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.\n\n :return: Decorator function for the step.\n """\n return step(name, THEN, converters=converters, target_fixture=target_fixture, stacklevel=stacklevel)\n\n\ndef step(\n name: str | StepParser,\n type: Literal["given", "when", "then"] | None = None,\n converters: dict[str, Callable[[str], Any]] | None = None,\n target_fixture: str | None = None,\n stacklevel: int = 1,\n) -> Callable[[Callable[P, T]], Callable[P, T]]:\n """Generic step decorator.\n\n :param name: Step name as in the feature file.\n :param type: Step type ("given", "when" or "then"). If None, this step will work for all the types.\n :param converters: Optional step arguments converters mapping.\n :param target_fixture: Optional fixture name to replace by step definition.\n :param stacklevel: Stack level to find the caller frame. This is used when injecting the step definition fixture.\n\n :return: Decorator function for the step.\n\n Example:\n >>> @step("there is a wallet", target_fixture="wallet")\n >>> def () -> dict[str, int]:\n >>> return {"eur": 0, "usd": 0}\n\n """\n if converters is None:\n converters = {}\n\n def decorator(func: Callable[P, T]) -> Callable[P, T]:\n parser = get_parser(name)\n\n context = StepFunctionContext(\n type=type,\n step_func=func,\n parser=parser,\n converters=converters,\n target_fixture=target_fixture,\n )\n\n def step_function_marker() -> StepFunctionContext:\n return context\n\n step_function_marker.pytest_bdd_step_context = context # type: ignore\n\n caller_locals = get_caller_module_locals(stacklevel=stacklevel)\n fixture_step_name = find_unique_name(\n f"{StepNamePrefix.step_def.value}{type or '*'}{parser.name}", seen=caller_locals.keys()\n )\n caller_locals[fixture_step_name] = pytest.fixture(name=fixture_step_name)(step_function_marker)\n return func\n\n return decorator\n\n\ndef find_unique_name(name: str, seen: Iterable[str]) -> str:\n """Find a unique name among a set of strings.\n\n New names are generated by appending an increasing number at the end of the name.\n\n Example:\n >>> find_unique_name("foo", ["foo", "foo_1"])\n 'foo_2'\n """\n seen = set(seen)\n if name not in seen:\n return name\n\n # Generate new names with increasing numbers\n for i in count(1):\n new_name = f"{name}{i}"\n if new_name not in seen:\n return new_name\n\n # This line will never be reached, but it's here to satisfy mypy\n raise RuntimeError("Unable to find a unique name")\n"
}
}
2025-12-02 12:04:47.078 [info] [Trace - 12:04:47 PM] Sending notification 'textDocument/didClose'.
2025-12-02 12:04:47.078 [info] Params: {
"textDocument": {
"uri": "file:///c%3A/--venv path--/Lib/site-packages/pytest_bdd/steps.py"
}
}
2025-12-02 12:04:47.084 [info] [Trace - 12:04:47 PM] Received notification 'window/logMessage'.
2025-12-02 12:04:47.084 [info] Params: {
"type": 2,
"message": "Skipping standard library file (stdlib excluded): c:\--venv path--\Lib\site-packages\pytest_bdd\steps.py"
}
2025-12-02 12:04:47.084 [info] [Warn - 12:04:47 PM] Skipping standard library file (stdlib excluded): c:--venv path--\Lib\site-packages\pytest_bdd\steps.py
2025-12-02 12:04:47.085 [info] [Trace - 12:04:47 PM] Received notification 'window/showMessage'.
2025-12-02 12:04:47.085 [info] Params: {
"type": 2,
"message": "Skipping standard library file (stdlib excluded): c:\--venv path--\Lib\site-packages\pytest_bdd\steps.py"
}
2025-12-02 12:04:47.085 [info] [Trace - 12:04:47 PM] Received notification 'textDocument/publishDiagnostics'.
2025-12-02 12:04:47.085 [info] Params: {
"uri": "file:///c%3A/--venv path--/Lib/site-packages/pytest_bdd/steps.py",
"diagnostics": []
}
2025-12-02 12:04:47.085 [info] [Trace - 12:04:47 PM] Received notification 'textDocument/publishDiagnostics'.
2025-12-02 12:04:47.085 [info] Params: {
"uri": "file:///c%3A/--venv path--/Lib/site-packages/pytest_bdd/steps.py",
"diagnostics": []
}
Outcome When Attempting Debugging Steps:
Did running it from the command line work? The logs do not indicate any command or running
Extra Details
- Project structure is a top-level script as entry point
entrypoint.py submodule |- __init__.py |- function.py - I have tried disabling all notifications from Flake8 and the notification still appears.