Skip to content

ModuleNotFoundError and can't run/debug unittest #17363

@davetapley

Description

@davetapley

Environment data

  • VS Code version: 1.60.0
  • Extension version (available under the Extensions sidebar): 2021.9.1218897484
  • OS and version: MacOS Mojave 10.14.6 (in a Codespace)
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.6 64-bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv --global
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: not set

Expected behaviour

unittest tests are automatically detected and show up in testing side bar"

Screen Shot 2021-09-09 at 19 25 42

Actual behaviour

They do not, and I get:

Screen Shot 2021-09-09 at 19 21 59

Steps to reproduce:

While working on https://github.com/JEFuller/dataclasses-configobj

Running on 2021.9.1191016588 is ✅
but updating to 2021.9.1218897484 is ❌

I can switch between versions and the tests appear and disappear, as show above ⬆️

Logs

Output for Python in the Output panel >

/usr/bin/python3 ~/.vscode-remote/extensions/ms-python.python-2021.9.1218897484/pythonFiles/testing_tools/unittest_discovery.py ./tests test_*.py
cwd: /workspaces/dataclasses-configobj
Error 2021-09-10 02:00:49: Error discovering unittest tests:
 Failed to import test module: test_core
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.9/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/workspaces/dataclasses-configobj/tests/test_core.py", line 7, in <module>
    from dataclasses_configobj import core
ModuleNotFoundError: No module named 'dataclasses_configobj'

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions