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.

collect()[source]

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.

repr_failure(excinfo)[source]

Print a representation when a test failes.

runtest()[source]

Run an AnyScript test item.

class anypytools.pytest_plugin.AnyTestSession[source]

Class for storing configuation of the AnyTest plugin to pytest.

configure(config)[source]

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.

anypytools.pytest_plugin.change_dir(path)[source]

Context manager for changing directories.

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

Collect AnyScript test files.

anypytools.pytest_plugin.pytest_collection_finish(session)[source]

Print the AnyBodyCon executable used in the test.

anypytools.pytest_plugin.pytest_configure(config)[source]

Configure the AnyTest framework.

anypytools.pytest_plugin.pytest_unconfigure(config)[source]

Finialize the test session.