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

Configure Tests command overrides project testpaths #23714

Closed
Jurriaan-BlueGen opened this issue Jun 27, 2024 · 4 comments
Closed

Configure Tests command overrides project testpaths #23714

Jurriaan-BlueGen opened this issue Jun 27, 2024 · 4 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@Jurriaan-BlueGen
Copy link

Jurriaan-BlueGen commented Jun 27, 2024

Type: Bug

Behaviour

Discover tests is overriding standard testpaths after configuration with the "Configure Tests" command.

By forcing the selection of the directory, the pytest --collect-only test discovery is run with a single directory as the argument, which overrides any testpaths set in external tools, for example pyproject.toml

If the command allows skipping of the directory selection, and doesn't set the related pytestArgs setting, test discovery will run normally.

Steps to reproduce:

  1. Configure project with pyproject.toml with [tools.pytest.ini_options] that defines testspaths = ["some","list","of/different","testpaths"]
  2. Open in vscode with python plugin
  3. Select "Python: Configure Tests" from action menu, or via "Testing" -> button
  4. Select pytest
  5. Select root directory
  6. Discover tests takes a long time in large directory trees (e.g. .venv, libs, etc) because the configured testpaths are being overridden.

Diagnostic data

From the Python output logs:

....
2024-06-27 07:39:05.246 [info] > ./.bluegen-venv/bin/python -m pytest -p vscode_pytest --collect-only .
2024-06-27 07:39:05.246 [info] cwd: .
2024-06-27 07:39:07.900 [info] ============================= test session starts ==============================
....

From the settings:

{
        ...
        "python.testing.pytestEnabled": true,
	"python.testing.pytestArgs": [
		"."
	],
        ...
}

Extension version: 2024.8.1
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:33:48.698Z)
OS version: Linux x64 6.8.0-36-generic
Modes:
Remote OS version: Linux x64 6.8.0-36-generic

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jun 27, 2024
@eleanorjboyd
Copy link
Member

Hi! If you delete all your pytest args (or more specifically the ".") does this fix the problem? Go to settings.json and look for "python.testing.pytestArgs"

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jun 27, 2024
@Jurriaan-BlueGen
Copy link
Author

Yes, it solves the problem, and it's what I did as a workaround.

It just took a while to figure out why the paths were being ignored, and why the discovery took so long.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jul 1, 2024
@eleanorjboyd
Copy link
Member

@Jurriaan-BlueGen understood thanks! We have the setup steps which include selecting what folder your tests are in but we should be more explicit about that answer being used to update / change the args

Copy link

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

Happy Coding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants