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.
-
collect
()[source] Yield test cases from a AnyScript test file.
-
-
class
anypytools.pytest_plugin.
AnyTestItem
(*k, **kw)[source] pytest.Item subclass representing individual collected tests.
-
reportinfo
()[source]
-
repr_failure
(excinfo)[source] Print a representation when a test failes.
-
runtest
()[source] 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
(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.
-
-
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_configure
(config)[source] Configure the AnyTest framework.