DEV Community

Discussion on: Snapshot Testing in Python

Collapse
leahein profile image
Leah Einhorn Author • Edited on

Good question! This is part of the pytest "magic". The short answer is that if you install snapshottest, that parameter will automatically be available when you run your tests with pytest. There is no need to import or define anything else!

The longer answer is that pytest uses fixtures as function arguments; if you're not familiar with it and want to learn more, you can read the docs here.
It looks for fixtures in several locations (and so you don't need to import them), a common one being conftest.py. In the case of the snapshottest library, the fixture is defined here and configured so that pytest knows where to look for it.

Hope that helps!