PyTest plugin.

Pytest is a fantastic test framework for Python code. AnyPyTools provides a pytest plugin for running and testing AnyBody models. The plugin make pytest collect and run AnyScript files with a test_ prefix (e.g. test_mymodel.any). Once loaded the plugin will attempt to execute a Main.RunTest operation if it exists. If the models produce error while loading and running, the framework considers it a failed test.

Created on Mon Sep 1 12:44:36 2014.

@author: Morten

exception anypytools.pytest_plugin.AnyException[source]

Custom exception for error reporting.

class anypytools.pytest_plugin.AnyTestFile(*k, **kw)[source]

pytest.File subclass for AnyScript files.


Yield test cases from a AnyScript test file.

class anypytools.pytest_plugin.AnyTestItem(*k, **kw)[source]

pytest.Item subclass representing individual collected tests.


Print a representation when a test failes.


Run an AnyScript test item.

save_output_files(src_folder, target_folder, result, hdf5files)[source]

Saves hdf5, macro, and log files from a test run and copy it to the target_folder

class anypytools.pytest_plugin.AnyTestSession[source]

Class for storing configuation of the AnyTest plugin to pytest.


Configure the AnyTestSession object.

This can’t be in __init__() since it is instantiated and added to the pytest namespace very early in the pytest startup.

class anypytools.pytest_plugin.DeferPlugin[source]

Simple plugin to defer pytest-xdist hook functions.

pytest_xdist_setupnodes(config, specs)[source]

called before any remote node is set up.


Context manager for changing directories.

anypytools.pytest_plugin.pytest_collect_file(parent, path)[source]

Collect AnyScript test files.


Print the AnyBodyCon executable used in the test.


Configure the AnyTest framework.