Concepts
Fixtup concepts are described on this page. They can help you
to better understand the advanced features.
- fixture
A fixture represent an isolated environment mount from a fixture template. A fixture usually live the time of the test. It’s behavior can be tune by policies
- fixture hook
hooks allow you to execute your own code when starting or stopping a fixture. There is a hook for each change of state in fixture livecycle. A hook is a python module inside of a fixture template. They are optional.
hook usecases :
Wait for the availability of a service before running a test
clean-up data from sqlite or postgres database
…
fixtup propose 6 hooks.
hook_mounted.py: executed when the fixture is mounted, i.e. the fixture’s template folder is copiedhook_started.py: executed when the fixture is started and every plugin has been runned, for example after docker-compose has run and after environment variables have been loadedhook_setup_data.py: runs between each test to mount data required at the start of the test. This hook is executed every time, even if the fixture remains in therunningstate between each test.hook_stopping.py: executed when the fixture stopshook_teardown_data.py: runs at the end of each test to clean up the data mounted at thesetup_datastep.hook_unmounting.py: executed before the folder containing the fixture is deleted
- fixture livecycle
A fixture has a livecycle. Unmounted fixture does not have physical existence. When a fixture is mounted, a space is created on disk to hold fixture content and environment. When it’s started, the environment relative to the fixture is running. It may be containers, environments variable, …
- fixture template
A fixture template is a definition of the environment to mount in a fixture. Fixtup takes the fixture template and instanciate a fixture from it.
- plugin
A plugin adds functionality to fixtup. A plugin is invoked during transitions in the lifecycle. The fixtup plugins rely on a definition file present in the fixture template. For example, .env for fixtup.plugins.dotenv plugin or docker-compose.yml for fixtup.plugins.docker.