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. Calls before_enter_case() and after_enter_case() plugin hooks. Also closes out the current Case Execution if it is an execution of the Default Case. enter_case(), unlike exit_case(), is called for executions of the Default Case.

Parameters:
  • case (TestCase DB model object) – A Test Case object.
  • test_address_parts (iterable of strings) – Will be recorded as the test address for the Test Execution. Primarily useful for rerun_execution_ids.
  • description (string) – A description of the Test Case for this Case Execution. Defaults to ''.
exit()

Called after the Execution Batch is completed. Tears down the Tissue. Closes out the last Default Case execution and calls the exit_test_cycle() plugin hook.

exit_case(result)

Called after a test has been executed, causes the Tissue to exit the current case. Calls before_exit_case() and after_exit_case() plugin hooks. Enters the Default Case. Note that exit_case(), unlike enter_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 the Tissue instance.

Parameters:sync_with_new (bool) – If True, the case_execution and test_cycle instances of the calling Tissue instance will be updated to the objects from the new session. Defaults to True.
Returns:A 2-tuple containing the newly created session and a dict containing the merge target (ex test_cycle and execution_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.