kondratyev-nv / vscode-python-test-adapter

Python Test Adapter for the VS Code Test Explorer
https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter
MIT License
117 stars 27 forks source link

Conflicting util #303

Open rojepp opened 9 months ago

rojepp commented 9 months ago

Setting this extension up, it fails discovery of most tests and the tests it discovers, many fail to run because of a conflict.

Failed to import test module: api_task_test

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/loader.py", line 407, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/loader.py", line 350, in _get_module_from_name
    __import__(name)
  File "/Users/rojepp/dev/cubed/tests/api_task_test.py", line 14, in <module>
    import api.api_task
  File "/Users/rojepp/dev/cubed/api/api_task.py", line 23, in <module>
    import legacy_api
  File "/Users/rojepp/dev/cubed/legacy_api.py", line 17, in <module>
    from notification import prepare_for_notification_send, send_chat_notification_to_user, send_notification_data
  File "/Users/rojepp/dev/cubed/notification.py", line 7, in <module>
    from utils import unix_time
ImportError: cannot import name 'unix_time' from 'utils' (/Users/rojepp/.vscode/extensions/ms-python.python-2023.19.12781014/pythonFiles/unittestadapter/utils.py)

It seems it's trying to import a utils.py other than the one in the root of my project. Not sure which. This is my settings.json:

{
    "python.testing.unittestArgs": [
        "-v",
        "-s",
        "./tests",
        "-p",
        "*_test.py"
    ],
    "python.testing.pytestEnabled": false,
    "python.testing.unittestEnabled": true

}

Any ideas?