2

Is there a way in pytest to add an attribute to a test, say for example "smoke test" or "regression" and then run only those tests?

bfan
  • 55
  • 1
  • 7
  • 1
    Possible duplicate of [Pytest: Deselecting tests](https://stackoverflow.com/questions/7395444/pytest-deselecting-tests) – hoefling Sep 14 '18 at 23:49

1 Answers1

8

Yes, you can use Markers for that.

See "Marking test functions and selecting them for a run"

Essentially, you will "mark" some of your tests with @pytest.mark.smoke and then launch them with a command like $ pytest -m smoke.

Laurent Bristiel
  • 6,819
  • 34
  • 52