Forrest logo
back to the pytest tool

pytest:tldr:f67e8

pytest: Exit as soon as a test fails or encounters an error.
$ pytest --exitfirst
try on your machine

The command "pytest --exitfirst" is used to run tests using the pytest framework with the "exit first" option enabled.

When running tests with pytest, by default, it executes all the tests in the specified directory or module. However, the "--exitfirst" option modifies this behavior.

With the "--exitfirst" option enabled, pytest will exit immediately on the first test failure or error it encounters. It won't continue executing any remaining tests or collecting additional test results. This can be useful in situations where you want to quickly identify and fix issues in your tests without waiting for the full test suite to complete.

By using this option, you can save time and get faster feedback on test failures or errors, allowing you to focus on fixing the problem rather than waiting for the entire test suite to run.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pytest tool