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.AnyFile(fspath, parent=None, config=None, session=None, nodeid=None)[source]

pytest.File subclass for AnyScript files.


Yield test cases from a AnyScript test file.

class anypytools.pytest_plugin.AnyItem(name, id, parent, defs, paths, **kwargs)[source]

pytest.Item subclass representing individual collected tests.


Print a representation when a test failes.


Run an AnyScript test item.

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.

get_save_fname(name, id, study)[source]

Return the name of the compare h5file

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.


Finialize the test session.