Open bigjools opened 2 weeks ago
what python version do you have? We haven't made any changes in this area recently (edit I see now it says 3.12)
What happens if you try and run unittest from the command line with the same arguments you have in your settings? Can you also try looking at your python path variable from the terminal vs the vscode run? I am thinking something in your path might not be showing up right as you are looking for a custom logger file
python3 -m unittest discover -v -s helios/tests -t . -p 'test*.py'
in the terminal works just fine.
Can you remind me how to work out what sys.path it would be using in its debugger runs?
Thanks.
if you add
import sys
print(sys.path)
at the very top of your file, before it attempts this import Failed to import test module: helios.tests.anchore.test_client
, which I think is caused by this import: File "/home/juledwar/src/helios/helios/tests/anchore/test_client.py", line 5, in <module> from unittest import mock
That first module looks mighty suspicious.
2024-10-29 08:56:44.240 [info] ['helios', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/unittestadapter/lib/python', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/unittestadapter', '/home/juledwar/src/helios/.hatch/lib/python3.12/site-packages/_pdbpp_path_hack', '/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload', '/home/juledwar/src/helios/.hatch/lib/python3.12/site-packages', '/home/juledwar/src/helios', '/home/juledwar/src/python-heliosclient', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/unittestadapter', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/unittestadapter', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/lib/python', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files', '/home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/lib/python']
Behaviour
Similar to the issue reported here https://github.com/microsoft/vscode-python/issues/16593 and somewhat in here https://github.com/microsoft/vscode-python/issues/17641#issuecomment-1953338728
Test discovery is crashing (see output below). This looks like it's the old problem of syspath being wrong and it is trying to import a local module called "logging" instead of the system one. This appears to be a regression, is it was working previously and nothing else has changed for me other than upgrading vscode and extensions.
Steps to reproduce:
Diagnostic data
settings.json test section:
Debugger output: