You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tests are discovered correctly but then an incorrect argument is supplied to PyTest, leading test-result discovery to fail (Git Submodules?) #17903
Discovered tests in workspace are run and their results displayed when doing CTRL+SHIFT+P: Test: Run All Tests.
Expect to run the command using the supplied path to the test folder.
Actual behaviour
Pytest fails to run, using the following command:
cwd: /work/repos/my_repo
Causing the error: ERROR - ModuleNotFoundError: No module named 'tests.integration_tests'
But it runs correctly when only running the tests in the tests folder and that can be achieved by clicking "Run All" on the "tests" subgroup:
This works without any issues, however this is not run when doing the VSCode Run All tests function and I have not been able to configure this working to command to be used.
Another way to get it working is ignoring the submodules in dependencies(they should be unit-tested using their own repos workflows) using --ignore-glob=dependencies/* in python.testing.pytestArgs. However I don't see why not manually ignoring submodules should break test(result) discovery.
So the first command fails while the two other commands work. I am not sure if it is intended for the first command to fail.
When using pytest from the terminal, all that's required to get it to run is a simple pytest.ini like this:
[pytest]
testpaths =
tests
and the simply doing pytest with the repo as cwd, no ignoring the dependencies folder required.
Steps to reproduce:
Replicate above repo structure with Pytest files in /tests and in /tests/integration_tests and include another repo as a submodule that also contains its own tests.
Activity
karthiknadig commentedon Nov 2, 2021
This will be resolved with #17242