Skip to content

ERROR: not found: /workspaces/master/tests/mytests.py::flake-8::FLAKE8 #6

@jolorke

Description

@jolorke

I am trying to use this plugin with Visual Studio Code and I get this error when trying to run unit tests in vscode:

ERROR: not found: /workspaces/master/tests/mytests.py::flake-8::FLAKE8
(no match in any of [<Module mytests.py>])

Running pytest with args: ['-p', 'vscode_pytest', '--no-cov', '--color=no', '--rootdir=/workspaces/master', '/workspaces/master/tests/mytests.py::flake-8::FLAKE8']
============================= test session starts ==============================
platform linux -- Python 3.10.16, pytest-9.0.1, pluggy-1.6.0
rootdir: /workspaces/master
configfile: pytest.ini
plugins: flake8-1.3.0, mock-3.15.1, asyncio-1.1.1, anyio-4.12.0, cov-7.0.0, html-4.1.1, metadata-3.1.1
asyncio: mode=strict, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 0 items

============================ no tests ran in 0.06s =============================
Finished running tests!

So, the test is not being run actually.

I think the problem is like this:
When vscode is discovering the available tests, I see this:

2025-12-03 09:53:40.937 [info] ============================= test session starts ==============================
platform linux -- Python 3.10.16, pytest-9.0.1, pluggy-1.6.0
rootdir: /workspaces/master
configfile: pytest.ini
testpaths: tests
plugins: flake8-1.3.0, mock-3.15.1, asyncio-1.1.1, anyio-4.12.0, cov-7.0.0, html-4.1.1, metadata-3.1.1
asyncio: mode=strict, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 1 item

<Dir master>
  <Dir tests>
    <Flake8File mytests.py>
      <Flake8Item flake-8>

========================== 1 test collected in 0.04s ===========================

So, a test named flake-8 is discovered inside the file mytests.py. But when I click in vscode to run the test, then pytest is started with the arguments as shown above:
-p', 'vscode_pytest', '--no-cov', '--color=no', '--rootdir=/workspaces/master', '/workspaces/master/tests/mytests.py::flake-8::FLAKE8'

It seems to add an additional ::FLAKE8 to the testname resultig in ::flake-8::FLAKE8.

When I shorten that manually on the command line to /workspaces/master/tests/mytests.py::flake-8 then it works.

Not sure this is an issue of vscode or of this plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions