Skip to content

test_nodebug broken if not running under tox #342

@int19h

Description

@int19h

This is specifically for running those tests via VSCode after opening the debugpy workspace.

The problem is that it uses debuggee.backchannel, which tries to import a bunch of stuff from debugpy.common. And this fails, because debugpy itself cannot be imported, because it's not on PYTHONPATH.

We try to make sure that it's there by setting PYTHONPATH=./src in .env - but that only works for test discovery, not for debuggee processes spawned by the tests, because the latter run in a different directory, and thus the meaning of . changes.

The fundamental problem here is that PYTHONPATH needs to be set to an absolute path for it to work consistently, and yet there's no way to use ${workspaceFolder} etc inside .env, which is necessary for that to be set in a workspace-independent way; nor is there any other way to define environment variables with expansions like that for Run Test (Debug Test can use launch.json, at least). That's microsoft/vscode-python#11932 - but in the meantime, we can hack around this in tests by checking whether debugpy comes from site-packages or not; and if not, manually add it to PYTHONPATH for debuggee.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2test issueTest failures and other issues with test runs and CI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions