Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tests not run #3

Open
sverhoeven opened this issue May 3, 2023 · 1 comment
Open

New tests not run #3

sverhoeven opened this issue May 3, 2023 · 1 comment

Comments

@sverhoeven
Copy link
Contributor

When I have a failing tests in a previous run and add a test then then ci only runs the failing tests. It does not run the new test.
I expected new tests and previously failed tests to be run.

See https://github.com/sverhoeven/pytest-lastfailed-test/actions

@sjvrijn
Copy link
Owner

sjvrijn commented May 3, 2023

Well, that is the expected behavior of the --last-failed flag for pytest:

$ pytest -h
[...]
  --lf, --last-failed   Rerun only the tests that failed at the last run (or all if none failed)
[...]

There is the --new-first flag which runs new test(file)s first. This blogpost (pytest v5.3.5) suggests they can be run together, but it doesn't seem to work on my machine with pytest v7.3.1. (Trying to install pytest 5.3.5 gives me TypeError: required field "lineno" missing from alias, so those dependencies are not sufficiently fixed either)

If there is a way to make --new-first work together with --last-failed, I do think it's a nice idea to include it, perhaps with an option to disable. If that's not easy to include, I'm inclined to keep the current behavior.

In either case, making the documentation more explicit about which tests are run in which case sounds worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants