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

Python test extension discovery of tests broken #24292

Closed
shane99a opened this issue Oct 11, 2024 · 5 comments
Closed

Python test extension discovery of tests broken #24292

shane99a opened this issue Oct 11, 2024 · 5 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@shane99a
Copy link

2024-10-11 16:47:32.732 [warning] could not find a pixi interpreter for the interpreter at /Users/xxx/.pyenv/versions/3.11.10/bin/python
2024-10-11 16:47:32.735 [info] > ~/.pyenv/versions/3.11.10/bin/python ~/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear test
2024-10-11 16:47:32.735 [info] cwd: .
2024-10-11 16:47:34.370 [error] Error discovering pytest tests:
 [n [Error]: sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute

	at ChildProcess.<anonymous> (/Users/xxx/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/out/client/extension.js:2:252414)
	at Object.onceWrapper (node:events:634:26)
	at ChildProcess.emit (node:events:519:28)
	at maybeClose (node:internal/child_process:1105:16)
	at ChildProcess._handle.onexit (node:internal/child_process:305:5)]

What is swigvarlink?

Additional info

experiments
• optOutFrom: ["pythonTestAdapter"]
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 11, 2024
@karthiknadig
Copy link
Member

@shane99a swigvarlink is something in your installation of python that seems. It has nothing to do with python extrension. You might want to re-create the environment you have.

Is there any particular reason why you have set optOutFrom: ["pythonTestAdapter"] .

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 12, 2024
@shane99a
Copy link
Author

I opted out for pythonTestAdapter by following the comments here: #23901 for a separate issue.
But having that on/off wasn't fixing the error.

But I figured out through a lot of debugging, that there was an import to an external library that is triggering the extension issue. I unfortunately cannot change anything regarding the external library there as I'm not sure where to even debug that code.

But here's where I'm a little confused because when I run the extension command in the terminal then it seems to run just fine:

~/.pyenv/versions/3.11.10/bin/python ~/.vscode/extensions/ms-python.python-2024.14.1-darwin-arm64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir ./test -s --cache-clear

[
    {
        "rootid": ".",
        "root": "/Users/xxx/xxx/xxx",
        "parents": [...],
        "tests": [...]
    }
]
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute

There is a json payload outputted which I assume is what the extension is using for display. I have hidden some of the json fields due to source code details but you get the idea.

Also I ran python -m pytest and it runs fine.

I don't think the DeprecationWarning is the issue. What I really would like is some useful stack trace errors or debug logs that could help point to the exact issue in the test extension.

I would appreciate some help here @karthiknadig .

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 13, 2024
@shane99a
Copy link
Author

Ok I figured it out. It turns out I had to then clear cache and reload window after opting into: pythonTestAdapter. So i guess I underestimated the implications of that setting.

@eleanorjboyd
Copy link
Member

Sorry for the delay! The work around is very interesting- didn't expect that to be the issue! We will me moving off the experiment (and making that the default) so hopefully that will avoid it in the future.

@eleanorjboyd
Copy link
Member

going to close this as it seems resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants