Skip to content

UI problems with tests #11497

Closed
Closed

Description

@ksamuel

Environment data

VSCode version: 1.44.2
OS: Ubuntu 20.04, Linux x64 5.4.0-26-generic
Extension version: 2020.4.76186, using Language Server
Python: 3.7.7 using "-m venv"
Pytest version: 5.4.1, with "-vv --capture=no --showlocals --exitfirst --failed-first"
python.languageServer: Microsoft

Expected behavior

When running an individual python test file using pytest from the VSCode UI, the tests should be marked as passed.

Also when a test function is discovered, it should have "run test | debug test" links above it.

Actual behavior

Even if the tests pass, sometimes they are not marked as passed, and seem to be running forever. However the log do show that they passed.

What's more, tests can only be triggered from the side bar, as the "run test | debug test" links don't appear above the test functions.

Steps to reproduce:

I couldn't find a way to reliably reproduce the problem: I tried to setup a minimal example, but it ran correctly.

Some clues:

  • The tests run with pytest from the terminal normally. They finish, and are labelled as passed
  • Running all the tests from the VSCode UI works as intended
  • Running individual test files from the VSCode UI may fail to mark the tests as passed

The test logs do state that the tests passed in all the cases, even when they are marked as still running:

=========================�[0m
�[1m============================= test session starts ==============================�[0m
platform linux -- Python 3.7.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- /home/user/.local/share/virtualenvs/ps/bin/python
cachedir: .pytest_cache
rootdir: /home/user/Work/dev_perso/postscriptum, inifile: ../../../../../media/user/shared/Work/dev_perso/postscriptum/setup.cfg
plugins: icdiff-0.4, subtests-0.3.0, testmon-1.0.2, xdist-1.31.0, cov-2.8.1, forked-1.1.3
�[1mcollecting ... �[0mcollected 2 items
run-last-failure: no previously failed tests, not deselecting items.

../../../../../../home/user/Work/dev_perso/postscriptum/::test_register_and_restore_except_handler <- ../../../../../media/user/shared/Work/dev_perso/postscriptum/tests/unit/test_excepthook.py �[32mPASSED�[0m
../../../../../../home/user/Work/dev_perso/postscriptum/::test_register_and_restore_except_handler_with_call <- ../../../../../media/user/shared/Work/dev_perso/postscriptum/tests/unit/test_excepthook.py �[32mPASSED�[0m

------------- generated xml file: /tmp/tmp-282165cdolyubcJ7t6.xml --------------
�[32m============================== �[32m�[1m2 passed�[0m�[32m in 0.10s�[0m�[32m ===============================�[0m

Here is a gif of the problem in action:

Peek 29-04-2020 10-55

Activity

  1. added
    triage-neededNeeds assignment to the proper sub-team
    bugIssue identified by VS Code Team member as probable bug
    on Apr 29, 2020
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Apr 29, 2020
  3. karrtikr commented on Apr 29, 2020

    @karrtikr

    Are you using pytest sugar plugin?

  4. ksamuel commented on May 4, 2020

    @ksamuel
    Author

    No, but I'm using the following pytest plugins:

    pip freeze | grep pytest
    pytest==5.4.1
    pytest-cov==2.8.1
    pytest-forked==1.1.3
    pytest-icdiff==0.4
    pytest-subtests==0.3.0
    pytest-testmon==1.0.2
    pytest-watch==4.2.0
    pytest-xdist==1.31.0

    On this particular project, I also have the following additional options in my setup.cfg:

     addopts = -v --color=yes --capture=no
    

    I assume the --color=yes is responsible for the color code we see in the vscode output. If vscode parses the output to determine if a test is passed, that could mess it up. That wouldn't explain why the test functions don't have links above them though.

  5. karrtikr commented on May 5, 2020

    @karrtikr

    That wouldn't explain why the test functions don't have links above them though.

    There're other extensions (for example, Liveshare) which are known to cause issues with Codelens (the links you're talking about). So please try disabling the other extensions and see if you reproduce the issue.

    If vscode parses the output to determine if a test is passed, that could mess it up.

    Yes, that's exactly what we've to do.

    Unfortunately I am unable to repro this, so the only solution I can offer is that you try removing the configurations to diagnose which one of them is causing a problem.

  6. karrtikr commented on Jun 5, 2020

    @karrtikr

    Closing as no further info was provided.

  7. ghost removed on Jun 5, 2020
  8. locked as resolved and limited conversation to collaborators on Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions