quicklinks

home TOC/contents
install changelog
examples customize
issues[bb] contact
Talks/Posts

Table Of Contents

Previous topic

Temporary directories and files

Next topic

Skip and xfail: dealing with tests that can not succeed

Marking test functions with attributes

By using the pytest.mark helper you can easily set metadata on your test functions. There are some builtin markers, for example:

  • skipif - skip a test function if a certain condition is met
  • xfail - produce an “expected failure” outcome if a certain condition is met
  • parametrize to perform multiple calls to the same test function.

It’s easy to create custom markers or to apply markers to whole test classes or modules. See Working with custom markers for examples which also serve as documentation.