pytest-repeat icon indicating copy to clipboard operation
pytest-repeat copied to clipboard

Multiplying tests should happen after -k

Open blueyed opened this issue 8 years ago • 7 comments

When used with -k to select only some specific tests, pytest still collects all tests, multiplied by the number passed to --count.

Therefore pytest --count=120 -x -k test_foo will collect the number of total tests times 120, which results in a lot of processing and memory usage.

I can imagine that pytest-repeat could be improved in this regard to only multiply the collected tests after -k was applied.

The workaround here is to specify the file containing the test, but that still multiplies the tests contained in this file.

platform linux -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
cachedir: .cache
Django settings: velodrome.settings (from environment variable)
plugins: testmon-0.9.4, repeat-0.4.1, profiling-1.2.6, pdb-0.2.0, mock-1.6.0, django-3.1.2, catchlog-1.2.2, asyncio-0.5.0, pylama-7.3.3

blueyed avatar Apr 24 '17 10:04 blueyed

@blueyed that is currently structurally impossible as of now since the multiplication uses a hidden autouse fixture as its about the only sane way to do it atm

RonnyPfannschmidt avatar Apr 24 '17 12:04 RonnyPfannschmidt

@RonnyPfannschmidt Isn't it possible to create new items in pytest_collection_modifyitems instead, based on copying an existing one?

blueyed avatar Oct 27 '19 03:10 blueyed

no

RonnyPfannschmidt avatar Oct 27 '19 04:10 RonnyPfannschmidt

Well, it's not easily possible, but should be probably, shouldn't it?

~~As for now / anyway, see https://github.com/pytest-dev/pytest/pull/6078.~~

blueyed avatar Oct 27 '19 04:10 blueyed

@RonnyPfannschmidt btw: the autouse fixture is removed in https://github.com/pytest-dev/pytest-repeat/pull/40.

blueyed avatar Oct 27 '19 05:10 blueyed

What's the status on this issue? Is this being worked on?

tylovescodes avatar Apr 15 '20 11:04 tylovescodes