Installation
The installation of Fixtup is done with pip.
pip install fixtup
Note
If you manage your dependencies through setup.py, setup.cfg, pyproject.toml, pipenv or poetry,
you should declare and install fixtup as a dev dependencies.
Configure fixtup on your project
To be able to use Fixtup, you must initialize it in your python project.
Fixtup can do that for you with the command
fixtup init
Warning
If you haven’t manifest for your project, you should declare one.
You will need a pyproject.toml which declares you want to use setuptools to package your project.
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
If you want to configure Fixtup all by yourself, look at the section relative to your project manifest.
Configure fixtup with setup.cfg
The first way to configure Fixtup is to add a section fixtup
in the setup.cfg manifest of your python project.
[fixtup]
fixtures=tests/fixtures
plugins=
fixtup.plugins.dotenv
fixtup.plugins.docker
Note
Fixtup crawls through your project tree to find python manifest
setup.cfg or pyproject.toml.
Configure fixture with pyproject.toml
Another way to configure Fixtup is to add a tools.fixtup section in
the pyproject.toml manifest of your python project.
[tools.fixtup]
fixtures=tests/fixtures
plugins=[
"fixtup.plugins.dotenv",
"fixtup.plugins.docker"
]
Configure fixtup as a module
You can also declare the fixtup path in a python module that will be included in your test suite.
Warning
This method is not recommended. You won’t be able to use the command line to create your new fixtures. However, it allows to have several fixtures repositories in your code base.
import os
import fixtup
SCRIPT_DIR = os.path.realpath(os.path.join(__file__, '..'))
fixtup.configure({"fixtures": os.path.join(SCRIPT_DIR, "../fixtures")})