Forrest logo
back to the pytest tool

pytest:tldr:4544d

pytest: Run tests matching or excluding markers.
$ pytest -m ${marker_name1 and not marker_name2}
try on your machine

This command is used for running pytest test cases with specific markers.

Here's the breakdown of the command:

  • pytest: It is the command to run pytest, a testing framework for Python.
  • -m: It is an option flag that specifies the marker(s) to be selected for running the test cases.
  • ${marker_name1 and not marker_name2}: It is a query syntax used to filter the test cases based on markers. The ${marker_name1} is the first marker, and the ${marker_name2} is the second marker. The keyword and is used to combine the markers, and the not keyword is used as a negation operator.

So, when running pytest -m ${marker_name1 and not marker_name2}, it will execute only the test cases that have the marker_name1 and don't have the marker_name2.

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