-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Debugging unit tests in a sub directory #11587
Comments
Unittest args require a
Because You can simply use the full path to specify the test location, or better use the variable
Let me know if that works. |
When you say "the following didn't work", it did work to a degree. With the settings like the following, it discovers the tests and runs them. But the tests are not run with the
I changed my settings as you suggested to the following but it then fails to discover the tests:
|
Hey @martingbrown , I am able to spot multiple issues here:
Multiple places to set The above alone should get you working, but I found some more issues:
For instance the following worked for me
Apologies for so many issues, let me know if this helps. Yours reminded me of #7176, where the guy used the above to solve his issues. |
I have now the settings.json set like this:
And I also have this in launch.json
And now it all seems to be working. Thanks for that. I appreiate the effort. If I had time I'd try and crack open the source code and try to help you out. |
No worries. But does running tests using the green play button work? From my understanding, as |
I'm working on Windows 10 with VSCode and the Python plugin. These are all up to date as far as I can tell.
I've some unittest tests that sit in a subdirectory of my main working directory called
.\src
. These in return load files in a second sub directory.\src\test\test.dat
. The tests simply refer to this astest\test.dat
as they assume the current directory is.\src
.I'm having real trouble getting testing setup so that this works. I've been able to run these in the past but debugging a test wasn't working. I changed my settings to:
And debugging started working, but the tests don't find the data file. Because the current working directory is just
.\
. If I change the settings to this debugging stops working. Surprisingly though vscode can still find and run the tests, even though my reading of this is that it should be looking in.\src\src
which does not exist.If I change the settings to this it can't even discover the tests:
I'm now totally confused as to how to set this up so that running tests works and debugging tests works and they both find the test files.
The text was updated successfully, but these errors were encountered: