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

Able to find tests but running tests on the wrong path #284

Open
rylew1 opened this issue Jul 27, 2022 · 1 comment
Open

Able to find tests but running tests on the wrong path #284

rylew1 opened this issue Jul 27, 2022 · 1 comment

Comments

@rylew1
Copy link

rylew1 commented Jul 27, 2022

Tests are found by the extension - but when I try to run them, they're being run at the wrong path. I'm using a Poetry venv in the default cache dir.

All tests are under:
/Users/me/Desktop/myproject/api/tests

How the test is being called when I try to run them (missing API folder):
/Users/me/Desktop/myproject/tests

From the Python Test Adapter Log:

INFO pytest at 'myproject': Running pytest with arguments: --rootdir=/Users/me/Desktop/myproject , Users/me/Desktop/project/tests/db/queries/my_test.py::test_fn

INFO pytest at 'myproject': Running /Users/me/Library/Caches/pypoetry/virtualenvs/myproject-api-NEejG4ix-py3.9/bin/pytest as an executable

CRIT pytest at 'myproject': Execution of the test Users/me/Desktop/project/tests/db/queries/my_test.py::test_fn" failed: Error: Process exited with code 4: ERROR: file or directory not found: 

VSCode Settings:

  "python.testing.pytestPath": "/Users/me/Library/Caches/pypoetry/virtualenvs/myproject-api-NEejG4ix-py3.9/bin/pytest", 
  "python.testing.unittestEnabled": false,
  "python.testing.pytestEnabled": true,
  "python.testing.pytestArgs": ["api/tests"],
@sunerpy
Copy link

sunerpy commented Aug 5, 2023

The same with me.

Wrong output:

2023-08-05T09:01:43.610Z INFO pytest at 'syncagent': Running pytest with arguments: --rootdir=/config/workspace/ProdDir/syncagent, --junitxml=/tmp/tmp-28125-l5ggf3levPkj, --override-ini, junit_family=xunit1, /config/workspace/ProdDir/syncagent/test_tecls.py
2023-08-05T09:01:43.610Z INFO pytest at 'syncagent': Running pytest as a Python module
2023-08-05T09:01:43.816Z CRIT pytest at 'syncagent': Execution of the test "/config/workspace/ProdDir/syncagent/test_tecls.py" failed: Error: Process exited with code 4: ERROR: file or directory not found: /config/workspace/ProdDir/syncagent/test_tecls.py

In fact, it's path is: /config/workspace/ProdDir/syncagent/pytest_dir/test_tecls.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants