VSCode unable to discover python unittest

Viewed 54

Seems like a rite of passage for using VSCode. Trying to setup python with unittest as my test configuration. Seems like all the tricks I have tried did not work. Here is what I know:

  1. The folder structure can run fine with python3 -m unittest so we know the tests are discoverable (this is not an issue of including __init__.py files).
  2. The PYTHONPATH is pointing to the repository properly (so this is not a PYTHONPATH issue)
  3. python.analysis.extraPaths are pointing to the repository properly (extraPaths are set)
  4. If I change the configuration to use pytest config instead of unittest, the tests become discoverable. Simply by changing the config to use pytest instead of unittest seems to make the difference.

You can find a repo that reproduces the issue here.

If someone is better versed in VSCode or Python please let me know what the issue is with unittest configuration that I show in the repo. Could it be a bug? I could not find anything on the other answers or bug reports that do not fall within the previous 3 categories.

0 Answers
Related