Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Test discovery failure / regression for uniitest #24578

Copy link
Copy link
Open
@bigjools

Description

@bigjools
Issue body actions

Behaviour

Similar to the issue reported here
#16593
and somewhat in here
#17641 (comment)

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:

  1. Create a repo with its own logging.py file
  2. Configure unittest as test runner
  3. Start the debugger and watch it fail to discover the tests

Diagnostic data

settings.json test section:

    "python.testing.unittestEnabled": true,
    "python.testing.unittestArgs": [
        "-v",
        "-s",
        "helios/tests",
        "-t",
        "${workspaceFolder}",
        "-p",
        "test*.py"
    ],

Debugger output:

2024-10-21 10:38:59.984 [info] shell: bash
2024-10-21 10:39:00.014 [info] Discovering unittest tests for workspace /home/juledwar/src/helios with arguments: /home/juledwar/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/unittestadapter/discovery.py,--udiscovery,-v,-s,helios/tests,-t,/home/juledwar/src/helios,-p,test*.py

2024-10-21 10:39:00.014 [info] > ./.hatch/bin/python ~/.vscode/extensions/ms-python.python-2024.16.1-linux-x64/python_files/unittestadapter/discovery.py --udiscovery -v -s helios/tests -t . -p test*.py
2024-10-21 10:39:00.014 [info] cwd: .
2024-10-21 10:39:00.230 [error] Unittest test discovery error for workspace:  /home/juledwar/src/helios 
 Failed to import test module: helios.tests.anchore.test_client
Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/loader.py", line 394, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/unittest/loader.py", line 337, in _get_module_from_name
    __import__(name)
  File "/home/juledwar/src/helios/helios/tests/anchore/test_client.py", line 5, in <module>
    from unittest import mock
  File "/usr/lib/python3.12/unittest/mock.py", line 26, in <module>
    import asyncio
  File "/usr/lib/python3.12/asyncio/__init__.py", line 8, in <module>
    from .base_events import *
  File "/usr/lib/python3.12/asyncio/base_events.py", line 18, in <module>
    import concurrent.futures
  File "/usr/lib/python3.12/concurrent/futures/__init__.py", line 8, in <module>
    from concurrent.futures._base import (FIRST_COMPLETED,
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 43, in <module>
    LOGGER = logging.getLogger("concurrent.futures")
             ^^^^^^^^^^^^^^^^^
AttributeError: module 'logging' has no attribute 'getLogger'

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.