In this lesson, you will learn:
- What fixtures are.
- About the fixture decorator.
- How to display your fixtures via the CLI.
What Are Fixtures?
Pytest fixtures are functions that run prior to test execution. The role of a fixture is to provide our tests with anything that it may need in order to run. For example, our test may need data. In fact, it may need data pulled from an external source (say, via a NetBox API). Or our test may require a test device to be spun up, then deleted after the tests are complete. All these things are actions and operations that can be performed by Pytest fixtures.