[bug] pytest_collect_file gets called multiple times#6088
[bug] pytest_collect_file gets called multiple times#6088blueyed wants to merge 2 commits intopytest-dev:featuresfrom
Conversation
testing/test_collection.py::test_collect_init_tests triggers the assert.
|
@blueyed the package feature has been a hack since a while, to correctly sort it out we need to reintroduce folders in the collection tree (which is also needed for aligning package scope fixtures with their actual packages) its something im working towards via the node detanglement ideas (#5975 and others help) |
|
|
||
| def _collectfile(self, path, handle_dupes=True): | ||
| key = (path, handle_dupes) | ||
| assert key not in self._collected, key |
There was a problem hiding this comment.
i'm not familiar with the code, how does this interact with handle_dupes?
There was a problem hiding this comment.
handle_duples is also a hack on top (IIRC even by me already). I just added it here. The code is not meant to stay.
_collectfile could use a cache/lookup to work around this - the main issue is that hooks shouldn't really be called multiple times. I've only noticed this when debugging some --lf stuff.
There was a problem hiding this comment.
#4319 . i actually merged it
i believe this will b better if we shift packages around so they are parents of modules and not alongside of modules
(then we can also attach conftests to packages/blank packages and finally get rid of the nodeid string matching hell)
testing/test_collection.py::test_collect_init_tests triggers the assert.
Unfortunately the whole Package feature was never properly done (this is not the first time I am running into issues with it).