我需要为我的项目使用pytest,但是VSCode似乎在寻找带有unittest的测试:
2024-08-27 13:40:52.737 [error] Unittest test discovery error for workspace: /Users/user/Desktop/lemonaide/MidiTok
Failed to import test module: test_attribute_controls
Traceback (most recent call last):
File "/Users/user/opt/miniconda3/envs/pertok/lib/python3.9/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "/Users/user/opt/miniconda3/envs/pertok/lib/python3.9/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/Users/user/Desktop/lemonaide/MidiTok/tests/test_attribute_controls.py", line 14, in <module>
from .utils_tests import (
ImportError: attempted relative import with no known parent package
我在用户和工作区设置中都有这个:
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
并且还尝试在Python: Configure Tests
下手动选择pytest
。
1条答案
按热度按时间jtoj6r0c1#
你好!你能提供完整的日志吗?我正在努力缩小它是如何到达那个错误的文件的范围。谢谢!