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

vscode testing extensions fails to discover tests in code_1.85.0-1701902998_amd64.deb #200543

Closed
gdshukla opened this issue Dec 11, 2023 · 13 comments
Assignees

Comments

@gdshukla
Copy link

gdshukla commented Dec 11, 2023

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: code_1.85.0-1701902998_amd64
  • OS Version: ubuntu 20.04.5 LTS (Focal Fossa)/Raspbian GNU/Linux 10 (buster) over ssh

Steps to Reproduce:

  1. install code_1.85.0-1701902998_amd64.deb on ubuntu 20.04.5 LTS (Focal Fossa)
  2. Connect to Raspbian GNU/Linux 10 (buster) node over ssh
  3. Create a python file and python test file.
  4. Open testing tab, click on Refresh Tests. It shows "Unittest discovery error"

In output tab, the error shown is:

2023-12-11 11:14:52.919 [info] Discover tests for workspace name: test - uri: /home/xxx/test
2023-12-11 11:14:52.919 [info] Running discovery for unittest using the new test adapter.
2023-12-11 11:14:52.954 [info] Discovering unittest tests for workspace /home/xxx/test with arguments: /home/xxx/.vscode-server/extensions/ms-python.python-2023.22.0/pythonFiles/unittestadapter/discovery.py,--udiscovery,-v,-s,./tests,-p,test_*.py

2023-12-11 11:14:52.955 [info] > ~/venv/bin/python ~/.vscode-server/extensions/ms-python.python-2023.22.0/pythonFiles/unittestadapter/discovery.py --udiscovery -v -s ./tests -p test_*.py
2023-12-11 11:14:52.955 [info] cwd: .
2023-12-11 11:14:53.110 [error] Traceback (most recent call last):
  File "/home/v/.vscode-server/extensions/ms-python.python-2023.22.0/pythonFiles/unittestadapter/discovery.py", line 17, in <module>

2023-12-11 11:14:53.111 [error]     from typing_extensions import Literal, NotRequired, TypedDict
  File "/home/xxx/.vscode-server/extensions/ms-python.python-2023.22.0/pythonFiles/lib/python/typing_extensions.py", line 874
    def TypedDict(typename, fields=_marker, /, *, total=True, **kwargs):
                                            ^
SyntaxError: invalid syntax

2023-12-11 11:14:53.140 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/xxx/test. Creating and sending error discovery payload 

2023-12-11 11:14:53.140 [error] Unittest test discovery error for workspace:  /home/xxx/test 
  
The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /home/xxx/test
2023-12-11 11:14:53.140 [info] ResultResolver EOT received for discovery.

It was working file with code_1.84.2-1699528352_amd64. I uninstalled code_1.85.0-1701902998_amd64 after encountering the error and reinstalled code_1.84.2-1699528352_amd64 but the error still persists.
I was able to reproduce same error on multiple nodes on ssh and from a different VDI also.

Disabled all extensions except python, same error
Screenshots:
vscode_test_setup
vscode_testing_error

@idmakers
Copy link

I slove error when I upgrad form python 3.7 to python 3.9

@gdshukla
Copy link
Author

I slove error when I upgrad form python 3.7 to python 3.9

Not in a position to change python version. Our modules depend upon this specific version only

@peacefulseeker
Copy link

Encountered the same for python 3.7.17 version

....
15, in <module>
    from typing_extensions import Protocol  # type: ignore
  File "/Users/alexey.vorobyov/.vscode/extensions/ms-python.python-2023.23.13391009/pythonFiles/lib/python/typing_extensions.py", line 874
    def TypedDict(typename, fields=_marker, /, *, total=True, **kwargs):
                                            ^
SyntaxError: invalid syntax
Version: 1.85.0 (Universal)
Commit: af28b32d7e553898b2a91af498b1fb666fdebe0c
Date: 2023-12-06T18:18:04.614Z (6 days ago)
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0

Could send more details, if/when someone picks that up for investigation.

@alexsanjoseph
Copy link

Same issue here on OSX Version: 1.85.0, It broke without any change in the code or settings

@eleanorjboyd
Copy link
Member

Hello! For the python extension we follow python.org and their schedule on which version we support. Here is their supported versions, https://devguide.python.org/versions/, and 3.7 has reached end of life for support. This means new releases of our extension will be compatible back to 3.8 as of now. As a work around, you can pin the version of the python extension which still worked for you with 3.7. You can see in the release notes of v2023.18.0 we dropped Python 3.7 support https://github.com/microsoft/vscode-python/releases so the previous version might be the best version to pin.

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
@alexsanjoseph
Copy link

alexsanjoseph commented Dec 13, 2023

I'm facing this issue with python 3.11.5

@eleanorjboyd
Copy link
Member

@alexsanjoseph could you send your logs? Also can you make sure that the python version you are using in this specific case is 3.11 in case you have a virtual environment or something else.

@alexsanjoseph
Copy link

Thanks @eleanorjboyd - I will create a fresh issue with reproducible examples

@peacefulseeker
Copy link

peacefulseeker commented Dec 14, 2023

@eleanorjboyd I've just created a dummy project with 1 test and platform darwin -- Python 3.7.17, pytest-7.4.3, pluggy-1.2.0 environment. it got discovered properly(with latest python/pylance extensions). Based on what you've mentioned about recent releases, that test would not be expected to be discovered, right?
Screenshot 2023-12-14 at 11 34 41
So, perhaps another extension creates a blocker for discovering. Will update here If I manage to find a hint.

@eleanorjboyd
Copy link
Member

@peacefulseeker it seems like the first mention of this used unittest not pytest which caused it to hit an issue at this file "/home/v/.vscode-server/extensions/ms-python.python-2023.22.0/pythonFiles/unittestadapter/discovery.py". Maybe if you try again with unittest the failure will occur?

@peacefulseeker
Copy link

That's right @eleanorjboyd . My bad did not pay enough attention to the original context, although for pytest that errors looked quite similar. I can confirm, that with unittest and py3.7 setup the discovery fails and the python output log says:

2023-12-15 11:01:41.137 [error]     from typing_extensions import Literal, NotRequired, TypedDict
  File "~.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/typing_extensions.py", line 874
    def TypedDict(typename, fields=_marker, /, *, total=True, **kwargs):

The good news is that with pytest and py3.7 environment that dummy test was discovered just fine.
Just need to dig into what's blocking discovery in my other project 😃

@peacefulseeker
Copy link

this helped(at least for now) microsoft/vscode-python#22650 (comment)

@ygonen
Copy link

ygonen commented Jan 4, 2024

I had the same issue with Python 3.7.12 .
I solved it by install version 2023.16.0 version of the Python extension.

	"customizations": {
		"vscode": {
			"extensions": [
				"[email protected]"
			],

@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2024
@eleanorjboyd eleanorjboyd reopened this Mar 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants