Skip to content

--last-failed --last-failed-no-failures none is now collecting much more tests than it did in 5.4.3 #8078

@symonk

Description

@symonk

Hi, in work I have been recently upgrading from pytest 5.4.3 -> 6.1.2, I observe a behaviour discrepency in the:

pytest_collection_modifyitems hook, in 5.4.3 given our setup we get the following:

pytest --last-failed --last-failed-no-failures none 
    # internal plugin registered via pytest_plugins=[]

    @pytest.hookimpl(trylast=True)
    def pytest_collection_modifyitems(self, items: List[Item]) -> None:
        try:
            for item in items:
                log.debug(f"collected item: {item.name}")
            do_something()
        except Exception as exc:
            pytest.exit(str(exc))

In the above snippet, the import thing is len(items) is 2. inline with this:

{
  "scrubbed/sensitive/info/test_two.py::TestTwo::test_two": true
  "scrubbed/sensitive/info/test_one.py::TestOne::test_one": true
}

I upgraded to 6.1.2 and with the same last failed cache highlighted above, len of the items in my hook implementation above is now pretty much every single test we have, 2600+.

note: This is barebones at the moment, scrubbing sensitive info is going to take a while

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: collectionrelated to the collection phasetype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions