On 16 Jul 2024, at 1:36, Oscar Benjamin wrote:

> I like this idea. I would want it to have behaviour that
> --lf=failed.txt checks if the file exists and if not populates it with
> the contents from the pytest ---lf cache. Then you could do:
>
> $ pytest
> < runts tests, some fail >
> $ pytest --lf=failed=txt
> < file doesn't exist so save last-failed there (from
> .pytest_cache/last_failed) and run the failed tests >
> $ pytest --lf=failed.txt
> < file exists now so run tests specified in the file >

Doing this based on the existence of the file causes a problem in my opinion. 
Let's say I ran this before at some point and the file exists with an old set 
of tests. Now I run the test suite and got new failures I want to store. I 
forget to remove the file and run with --lf=failed.txt. Now the old set of 
tests is used, the new set is gone and I have to re-run the whole suite, which 
is exactly what I wanted to prevent in the first place.

Regards,
Florian
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to