Tissue¶
-
class
sneeze.database.interface.
Tissue
(db_config_string, test_cycle_name, test_cycle_description, environment, host, command_line_arguments, start_time=None, test_cycle_id=None, declarative_base=<class 'sqlalchemy.ext.declarative.api.Base'>, engine=None, session_factory=None, rerun_execution_ids=[])¶ The Tissue is the core component of Sneeze; it catches everything from your nose when you Sneeze. The Tissue loads the DB models, manages the DB connection, and acts as a state machine for the system as a whole.
Primary attributes include a lock used to control access to the database, a session factory to generate sessions, a list of active Plugin Managers, and a dictionary of added db model classes.
-
enter_case
(case, test_address_parts, description='')¶ Causes the
Tissue
to enter a new Case Execution for the given Test Case. Callsbefore_enter_case()
andafter_enter_case()
plugin hooks. Also closes out the current Case Execution if it is an execution of the Default Case.enter_case()
, unlikeexit_case()
, is called for executions of the Default Case.Parameters: - case (
TestCase
DB model object) – A Test Case object. - test_address_parts (iterable of
string
s) – Will be recorded as the test address for the Test Execution. Primarily useful forrerun_execution_ids
. - description (
string
) – A description of the Test Case for this Case Execution. Defaults to''
.
- case (
-
exit
()¶ Called after the Execution Batch is completed. Tears down the
Tissue
. Closes out the last Default Case execution and calls theexit_test_cycle()
plugin hook.
-
exit_case
(result)¶ Called after a test has been executed, causes the
Tissue
to exit the current case. Callsbefore_exit_case()
andafter_exit_case()
plugin hooks. Enters the Default Case. Note thatexit_case()
, unlikeenter_case()
, is not called for executions of the Default Case.Parameters: result ( string
) – The result of the just completed Case Execution.
-
make_session
(sync_with_new=True)¶ Wraps the
SQLAlchemy
session factory for theTissue
instance.Parameters: sync_with_new ( bool
) – IfTrue
, thecase_execution
andtest_cycle
instances of the callingTissue
instance will be updated to the objects from the new session. Defaults toTrue
.Returns: A 2-tuple containing the newly created session and a dict
containing the merge target (extest_cycle
andexecution_batch
) model instances from the newly created session.
-
session_transaction
()¶ Returns a context manager that handles grabbing the
Tissue
‘s lock and committing the session automatically.
-
start
()¶ Called to begin the Execution Batch being run in this
Tissue
, enters the batch’s Default Case.
-