Overview - Built-in markers (skip, skipif, xfail)
What is it?
Built-in markers in pytest are special labels you add to tests to control when they run. The main markers are skip, skipif, and xfail. Skip tells pytest to ignore a test completely. Skipif skips a test only if a certain condition is true. Xfail marks a test as expected to fail, so it doesn't cause the whole test run to fail.
Why it matters
These markers help manage tests that are not always relevant or ready to pass. Without them, tests that fail due to known reasons would break the test suite and cause confusion. They let you focus on real problems and keep your testing process smooth and meaningful.
Where it fits
Before learning markers, you should understand basic pytest test functions and assertions. After mastering markers, you can explore custom markers, parameterized tests, and test fixtures to build flexible and maintainable test suites.