Overview - Custom markers
What is it?
Custom markers in pytest are labels you add to tests to organize, select, or skip them based on specific conditions. They let you tag tests with meaningful names like 'slow' or 'database' so you can run or ignore groups of tests easily. This helps manage large test suites by controlling which tests run and when. Markers are simple to add and use in pytest configuration and command line.
Why it matters
Without custom markers, running or skipping specific tests in big projects would be hard and slow. You might waste time running all tests when only some are relevant, or miss running important groups. Custom markers solve this by letting you quickly pick tests by category, improving testing speed and focus. This saves developers time and helps catch bugs faster.
Where it fits
Before learning custom markers, you should know basic pytest test writing and running tests. After this, you can learn about pytest fixtures and parameterization to write more flexible tests. Later, you might explore pytest hooks and plugins to customize test behavior even more.