Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13921

VScode can't find python unittest

$
0
0

I've set up a test in VScode, if I normally run it in the powershell it works fine, but I'm struggling in finding how to properly set it as a test in vscode.

I've already tried all of the thing I found so:

  • addedd an __init__.py file in the test directory
  • in the command palette tried the configure test -> unittest -> .root -> test_, nothing happens
  • uninstalled python extension, reinstalled it and doing the process again
  • this is my settings.json:
{"python.testing.unittestArgs": ["-v","-s","./Tutto","-p","*test*.py"   ],"python.testing.pytestEnabled": false,"python.testing.unittestEnabled": true,"python.testing.pytestArgs": ["."   ]}

No errors, it just can't find tests.

The project is in the Tutto folder, the scripts are in a folder named src and the test file in another folder inside src named test (where there is the test_blabla.py and the init.py)

edit: I found a workaround by replacing "./Tutto" in the setting.json with the entire path of the test folder, and now at least the test extension is working fine, but 2 things still remains:

  • I don't have the run test and debug test functionalities in the code
  • Now the entire VSCODE is pointing at the tests for the "Tutto" project, but what if I have another project with its own test folder?

Viewing all articles
Browse latest Browse all 13921

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>