Skip to content

Phase 2: Add missing test coverage before shared package extraction #496

@edvilme

Description

@edvilme

Phase 2: Test Coverage — Add missing tests before extraction

Part of the shared package extraction effort: microsoft/vscode-python-tools-extension-template#290

The following merged PRs introduced bug fixes or features that lack adequate test coverage. Tests should be added before extracting shared code into the monorepo package to ensure behavioral correctness is preserved.

PR Untested functionality description Missing tests
#325 Use global settings for ignorePatterns default Changed _get_global_defaults to read ignorePatterns from GLOBAL_SETTINGS. Ignore pattern tests exist but pass patterns via per-workspace init settings, not global settings. Global-to-workspace default inheritance is not tested.
#342 use correct capitalization of file paths to work around mypy issue Changed document.path to pathlib.Path(document.path).resolve() for Windows capitalization. Linting and path tests exercise the code path but do not verify Windows path casing normalization.
#344 update capitalization of cwd to match file path Added pathlib.Path(cwd).resolve() for Windows path capitalization. Tests exercise the code path but CI runs on Linux where capitalization is not an issue.
#346 fix: bug where successive python changed events trigger creating multiple servers Added debounce logic in extension.ts, event deduplication in python.ts, moved getInterpreterFromSetting. Python and settings tests exist but do not test the debounce behavior or multiple rapid restart prevention.
#347 Add dmypy status file setting Added daemonStatusFile setting to settings.ts and lsp_server.py. Settings TS tests exist but do not assert the new daemonStatusFile property. Non-daemon test exercises dmypy args but uses default empty status file, not a custom one.
#357 When cwd config option is nearestConfig, look for all of mypy.ini, .mypy.ini, pyproject.toml, setup.cfg Extended nearestConfig to search for .mypy.ini, pyproject.toml, setup.cfg. Existing tests cover nearestConfig but only create mypy.ini; no tests verify .mypy.ini, pyproject.toml, or setup.cfg detection.
#375 Fix: parse mypy diagnostics from stderr in non_interactive mode Changed _linting_helper to combine stdout+stderr for diagnostic parsing. Linting and non-daemon tests exercise the pipeline but none produce diagnostics on stderr to verify the combined parsing works.
#442 Sync with template: Fix duplicate server handlers on concurrent restarts Changed src/common/server.ts (disposables cleanup) and src/extension.ts (try/catch in deactivate). No tests exist for server restart or deactivation logic.
#467 Replace hand-rolled typings with @vscode/python-environments npm package Replaced extensions.getExtension() with PythonEnvironments.api() from @vscode/python-environments. TS tests cover interpreter resolution but test stubs may use old getExtension pattern rather than new PythonEnvironments.api() import.
#470 Use contextlib.suppress instead of try-except-pass in lsp_utils.py Changed _run_api in lsp_utils.py to use contextlib.suppress(SystemExit). Tests exercise _run_api through the linting pipeline and non-daemon mode, but none specifically test the SystemExit suppression behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions