To run the tests, call pytest.
Mocks for commands¶
We provide mocks (stand-ins) for all tools that we want to exercise in tests (located in
These mocks are very simplified “models” of the actual tool, and are called instead of the actual tool.
They are prepended to
PATH by the setup code in the
edalize_common.make_edalize_test() pytest fixture.
In the easiest case, these mocks just write out the commandline they were called with (into a file
In a more complex test setup (e.g. for
if a tool is creating files, we create it too (the file to create is taken from a tool option given)
we make the file executable
we set the access and modified times of generated files to the current time
To define a testcase, use the
edalize_common.make_edalize_test() pytest factory fixture.
This defines a factory that you can call to set up a mocked-up backend appropriately.
See the documentation for
edalize_common.TestFixture for details of the supported keywords.
backend attribute of the returned fixture has
The testcase should call these in order, setting up files as necessary between calls and checking whether the results match by calling the fixture’s
If the environment variable
GOLDEN_RUN is set, the
compare_files() method copies the generated files are copied to become the new reference files, rather than checking their contents.