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

Unable to run pytest in rewrite, fails with wrong testID #21397

Closed
eleanorjboyd opened this issue Jun 9, 2023 · 0 comments · Fixed by #21399
Closed

Unable to run pytest in rewrite, fails with wrong testID #21397

eleanorjboyd opened this issue Jun 9, 2023 · 0 comments · Fixed by #21399
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug partner ask triage-needed Needs assignment to the proper sub-team

Comments

@eleanorjboyd
Copy link
Member

eleanorjboyd commented Jun 9, 2023

Trying to use pytest in the test explorer with the following folder: dummy.zip

On the stable release of the extension, tests are not discovered at all. On the rewrite (which can be opted into by the setting "python.experiments.optInto": ["pythonTestAdapter"],) the tests are discovered correctly but running the tests does not work.

image

Error on run is: (no name '/Users/eleanorboyd/Downloads/dummy 2/tests/test_dummy.py::test_dummy_sum' in any of [<Module tests/test_dummy.py>])

Therefore the test ids are somehow being confused.

From the integrated terminal, the following work successfully:
pytest "/Users/eleanorboyd/Downloads/dummy 2/tests/test_dummy.py::test_dummy_sum" and pytest tests/test_dummy.py::test_dummy_sum .

@eleanorjboyd eleanorjboyd added bug Issue identified by VS Code Team member as probable bug area-testing partner ask labels Jun 9, 2023
@eleanorjboyd eleanorjboyd self-assigned this Jun 9, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jun 9, 2023
@karthiknadig karthiknadig changed the title Unable to run pytest in rewrite, wrong testID Unable to run pytest in rewrite, fails with wrong testID Jun 9, 2023
eleanorjboyd added a commit that referenced this issue Jun 9, 2023
fixes #21397. The issue
came from the setup of running a script that then runs pytest which is
different then pytest discovery which runs pytest as a module. The run
script didn't work since the script did not insert the cwd into the path
like what is done when running a module. This change inserts the cwd.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug partner ask triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant