Development

Testing with py.test

py.test fixtures and setup

conftest.plot(request)[source]
conftest.tpath_preclear(request)[source]

Fixture that indicates that the test path should be cleared automatically before running each test. This cleans up the test data.

conftest.tpath(request)[source]

Fixture that takes the value of the special test-specific folder for test run data and plots. Usually the <folder of the test>/test_results/test_name/

conftest.tpath_join(request)[source]

Fixture that joins subpaths to the value of the special test-specific folder for test run data and plots. Usually the <folder of the test>/test_results/test_name/.

This function should be use like test_thing.save(tpath_join(‘output_file.png’))

conftest.fpath(request)[source]

py.test fixture that returns the folder path of the test being run. Useful for accessing data files.

conftest.fpath_join(request)[source]

py.test fixture that runs os.path.join(path, *arguments) to merge subpaths with the folder path of the current test being run. Useful for referring to data files.

conftest.closefigs()[source]
conftest.test_trigger()[source]

This fixture provides a contextmanager that causes a function to call if an AssertionError is raised. It will also call if any of its argument, or keyword arguments is true. This allows you to conveniently force calling using other flags or fixtures.

The primary usage of this is to plot outputs only on test failures, while also allowing plotting to happen using the plot fixture and pytest cmdline argument

conftest.ic()[source]

Fixture to provide icecream imports without requiring that the package exist

conftest.pprint(request, tpath_join)[source]

This is a fixture providing a wrapper function for pretty printing. It uses the icecream module for pretty printing, falling back to ipythons pretty printer if needed, then to the python build in pretty printing module.

Along with printing to stdout, this function prints into the tpath_folder to save all output into output.txt.

py.test setup hooks

conftest.pytest_addoption(parser)[source]

py.test helper functions

conftest.tpath_raw_make(request)[source]
conftest.fpath_raw_make(request)[source]
conftest.relfile(_file_, *args, fname=None)[source]
conftest.relfile_test(_file_, request, pre=None, post=None, fname=None)[source]

Generates a folder specific to py.test function (provided by using the “request” fixture in the test’s arguments)

Git setup for development

PyPI Releases

versioning