Skip to content

Negation filter deselects all tests if it contains a part of the path of rootdir #5889

Open
@quarckster

Description

@quarckster

pip list

atomicwrites (1.3.0)
attrs (19.1.0)
importlib-metadata (0.23)
more-itertools (7.2.0)
packaging (19.2)
pip (9.0.1)
pkg-resources (0.0.0)
pluggy (0.13.0)
py (1.8.0)
pyparsing (2.4.2)
pytest (5.2.0)
setuptools (39.0.1)
six (1.12.0)
wcwidth (0.1.7)
zipp (0.6.0)

pytest and operating system versions

pytest-5.2.0
ubuntu 18.04 x64

Reproducer

$ pwd
/tmp/another_dir
$ cat test_pytest_bug.py
def test_pytest():
    assert True
$ cd /tmp/some_dir
$ pytest -v -o testpaths="/tmp/another_dir" -k "not some_dir" 
==========================test session starts===============================
platform linux -- Python 3.6.8, pytest-5.2.0, py-1.8.0, pluggy-0.13.0 -- /tmp/test/bin/python3
cachedir: .pytest_cache
rootdir: /tmp/some_dir, testpaths: /tmp/another_dir
collected 1 item / 1 deselected    
$ cd /tmp/another_dir
$ pytest -v -o testpaths="/tmp/another_dir" -k "not some_dir"
==========================test session starts===============================
platform linux -- Python 3.6.8, pytest-5.2.0, py-1.8.0, pluggy-0.13.0 -- /tmp/test/bin/python3
cachedir: .pytest_cache
rootdir: /tmp/another_dir, testpaths: .
collected 1 item                                                                                                                                                                                                 

test_pytest_bug.py::test_pytest PASSED

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: selectionrelated to test selection from the command linetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions