Plugins¶
The behavior of Sneeze can be modified and extended by implementing plugins.
Entrypoints¶
The Sneeze plugin API utilizes 3 distutils entrypoints to add functionality to
the system. They share a root nose.plugins.sneeze.plugins
.
add_options¶
nose.plugins.sneeze.plugins.add_options
allows a plugin to add new command
line arguments to nosetests. It should point at a callable that expects an
options parser and an environment string; return values are ignored.
managers¶
nose.plugins.sneeze.plugins.managers
allows a plugin to define a
Plugin Manager to execute the behavior of the plugin during test exection.
It should point to a class that utilizes the Sneeze plugin API.
add_models¶
nose.plugins.sneeze.plugins.add_models
allows a plugin to extend the DB
schema by adding new models to the ORM. It should point to a callable that
expects a SQLAlchemy declarative base object.
It should return a dictionary containing key value pairs where the key is a
string of the model name and the value is the model itself for all “public”
models implemented.
API¶
The Sneeze API generally assumes that Plugin Managers will use the Tissue instance from initialization to retrieve any needed state, so the calls generally avoid passing any information as arguments that could be obtained through the Tissue.
-
enter_test_cycle
()¶ Called once, after the Tissue has been initialized, before any Case Executions are started.
-
before_enter_case
()¶ Called before entering each case. Note that this is called when entering a Default Case as well.
-
after_case
(case, description)¶ Called after a case has been entered, but before it is run. Receives a Case object for
case
and a stringdescription
.
-
handle_pass
()¶ Called from
nose
APIaddSuccess()
, when a test has passed.
-
handle_fail
(error)¶ Called from
nose
APIaddFailure()
andaddError()
in cases where the test errored (generally, raised an uncaught exception). Receives a string aserror
.
-
handle_skip
(error)¶ Called from
nose
APIaddError()
in cases where the test was skipped or is deprecated, receives a string aserror
containing any message from the skip or deprecation exception.
-
before_exit_case
(result)¶ Called before a Case Execution result is recorded, after it has completed and :func:handle_failor :func:handle_pass have been called. Receives a string as
result
. Note that this is not called for Case Executions of the Default Case.
-
after_exit_case
(result)¶ Called after the result has been recorded for a Case Execution, but before entering an execution of the Default Case. Note that this is not called for Case Executions of the Default Case.