Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Explorer hangs (because it is stuck at the test collection stage) after the "Python" extension is updated to v2024.22.1 #236901

Open
nongnoochr opened this issue Dec 24, 2024 · 2 comments
Assignees

Comments

@nongnoochr
Copy link

nongnoochr commented Dec 24, 2024

My "Python" extension has the Auto Update set, and today (Tue December 24, 2024) around 1:30pm (GMT+7), the auto update was kicked in to install v2024.22.1 on my Macbook (Sequoia 15.2 (24C101) ) and the pytests in my project are no longer discovered (i.e. the test discovery process is never finished)

Note that I disabled all other extensions and found that the "Python" extension is the culprit here.
This issue is resolved after revert back to version v2024.22.0 by choosing the "Install Specific Version" option in the context menu

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: Version: 1.96.2 (Universal)
  • OS Version: Sequoia 15.2 (24C101)

Steps to Reproduce:

  1. Update the "Python" extension in vscode to the latest one (v2024.22.1)
  2. Open a project with multiple pytests (My project have a mixture of sync and async pytests, pytest parametrization, test class etc.)
  3. Select the Tests tab. Notice that no tests show up (or only one show up). If you inspect in the "OUTPUT" tab, you'll see that the tests never finish the test discovery phrases.
@WellingtonNico
Copy link

WellingtonNico commented Dec 24, 2024

Same problem here, there is not error logs, never ends finding tests, but in the python test logs pytest collect almost finished

this is the image of the hanging

Image

this is the logs when it collects successfully

[1m============================= test session starts ==============================�[0m
platform darwin -- Python 3.11.3, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/teste/projetos/pessoal/python/fastapi-todo-list
configfile: pytest.ini
plugins: asyncio-0.24.0, cov-6.0.0, anyio-4.7.0, xdist-3.6.1
asyncio: mode=Mode.AUTO, default_loop_scope=None
collected 1 item

<Dir fastapi-todo-list>
  <Package tests>
    <Module test_first.py>
      <Function test_first_test>

�[32m========================== �[32m1 test collected�[0m�[32m in 0.01s�[0m�[32m ===========================�[0m
Starting now, all test run output will be sent to the Test Result panel, while test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel. The "Python Test Log" channel will be deprecated within the next month. See https://github.com/microsoft/vscode-python/wiki/New-Method-for-Output-Handling-in-Python-Testing for details.

this is the log for that project that does hang when collecting

you can notice there is a log missing at the end that exists in the above log: test collected

�[1m============================= test session starts ==============================�[0m
platform darwin -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0 -- /Users/teste/projetos/pessoal/python/fastapi-todo_list/.venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/teste/projetos/pessoal/python/fastapi-todo_list
configfile: pytest.ini
plugins: asyncio-0.24.0, cov-6.0.0, anyio-4.7.0, xdist-3.6.1
asyncio: mode=Mode.AUTO, default_loop_scope=None
�[1mcollecting ... �[0mcollected 17 items

<Dir fastapi-todo_list>
  <Package tests>
    <Dir auth>
      <Module test_auth_api.py>
        <Coroutine test_signup>
        <Coroutine test_login>
        <Coroutine test_me_with_todos>
        <Coroutine test_me_without_todos>
        <Coroutine test_logout_on_get_and_post>
    <Dir main>
      <Module test_main.py>
        <Coroutine test_healthy>
    <Dir todo>
      <Module test_todo_api.py>
        <Coroutine test_get_user_todos_security>
        <Coroutine test_get_user_todos>
        <Coroutine test_create_todo_security>
        <Coroutine test_create_todo>
        <Coroutine test_create_todo_title_validation>
        <Coroutine test_update_todo_security>
        <Coroutine test_update_todo>
        <Coroutine test_delete_todo_security>
        <Coroutine test_delete_todo>
        <Coroutine test_count_user_todos>
        <Coroutine test_get_todos_full>

I tried both with same python version and it does not work as well, both projects have the same dependencies, the only difference are the tests. In my Django projects the tests stopped working too, they were working just fine yesterday(2024/12/23), the same problem occurs, hangs when collecting the tests.

what I already tried:

  • fresh install
  • new user with totally fresh install and only the needed extensions(I thought it was gonna work)
  • different python versions

I'm currently using macOS, latest version with m3 pro chip, I also made sure I'm using the correct build version for apple silicon.

update

inside devcontainer it finds the tests and also run, but I was not able to debug them like yesterday, the debug menu appears, I can even set the breakpoints but the code never pauses(and yes, I'm did debug tests inside dev container before and it was working).
I have just a few extensions inside dev container, more than when I tested with fresh instalation with new user, for me it looks like something maybe related to macos

what worked

I downgraded python, and debugpy extension version, the tests were found, for all projects, but I still was not able to debug them, accidentaly I noticed it worked for a new project that I created just to test this case, so I cloned my repo into a new folder and everything worked again, so I also tried to update the python extensions again and It broke again, :(

@ryanapfel
Copy link

Also experiencing this! For me this occurred after downloading the 1.96.1 update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants