Skip to content

[FEATURE] Clean up tearDown patterns in unit tests (gc.collect + sleep) #185

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Is your feature request related to a problem? Please describe.
Several test classes use gc.collect() + time.sleep(0.1) in tearDown to work around resource cleanup timing issues with tempfile.TemporaryDirectory. This is fragile and was flagged during PR #181 review (comments here and here). Deferred from that PR to keep the bug fix focused.

Describe the solution you'd like

  • Replace gc.collect() + sleep with explicit file handle cleanup or use tempfile.mkdtemp() with shutil.rmtree(ignore_errors=True) in tearDown.
  • Audit other test files for the same pattern and fix consistently.

Describe alternatives you've considered

  • Keeping the current pattern (not ideal — adds unnecessary test latency and masks resource leaks).

Additional context
Affected files:

  • tests/unit/test_vscode_adapter.py — classes TestVSCodeStdioRegistryPackages, TestVSCodeInferRegistryName, TestVSCodeExtractPackageArgs, TestVSCodeRealApiFormat

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageNew issue, not yet reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions