lmtest.base package

Submodules

lmtest.base.controller module

Module containing test controller class.

class lmtest.base.controller.Controller(pidfile, log=None)[source]

Bases: lmtest.base.daemon.Daemon

Test controller.

add_tests(new_tests)[source]

Add a new test object to run.

Parameters

new_tests (list of LmTest) – A list of test objects to run.

initialize()[source]

Initialize the test controller.

report()[source]

Report the status of the tests that were ran in the last interval.

report_interval = 86400
rest(sleep_seconds=10)[source]

Sleep before trying to run the next test.

Note: This is abstracted just a bit in case we want to sleep for

“smart” intervals, such as until the next test is scheduled to run.

Parameters

sleep_seconds (int, optional) – The number of seconds to sleep.

run()[source]

Run the test controller until told to stop.

run_test(test_to_run)[source]

Run a test and process the result.

Parameters

test_to_run (LmTest) – The test that should be run.

set_notifier(notifier)[source]

Set the Controller instances notification method.

Parameters

notifier (Notifier) – The notifier to use for this instance.

set_report_interval(interval_seconds)[source]

Set the Controller instances reporting interval.

Parameters

interval_seconds (int) – The number of seconds to wait between reports.

lmtest.base.daemon module

This module contains a base-Daemon class.

class lmtest.base.daemon.Daemon(pidfile, log=None)[source]

Bases: object

A generic daemon class.

Usage: subclass the Daemon class and override the run() method

daemonize()[source]

Do the UNIX double-fork magic.

See:
Stevens’ “Advanced Programming in the UNIX Environment”

(ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16

delpid()[source]

Clean up by removing PID file.

initialize()[source]

Initialize the daemon process.

on_shutdown()[source]

Perform a graceful shutdown operation of the daemon process.

on_update()[source]

Do whatever is necessary to update the daemon.

restart()[source]

Restart the daemon.

run()[source]

Run the daemon process.

start()[source]

Start the daemon.

status()[source]

Check the status of the daemon.

stop()[source]

Stop the daemon.

Raises

Exception – Raised if the PID file cannot be deleted.

update()[source]

Signal a running process to update itself.

Send a signal to the running process to have it update itself. This update is defined by the subclass and could mean re-reading a configuration file, checking the environment, or something else.

class lmtest.base.daemon.DaemonCommands[source]

Bases: object

Class containing command constants.

RESTART = 'restart'
START = 'start'
STOP = 'stop'

lmtest.base.test_base module

Base classes for Lifemapper tests.

class lmtest.base.test_base.LmTest(delay_time=0)[source]

Bases: object

Base class for tests.

add_new_test(test)[source]

Add a new test to run based on the current test status.

Parameters

test (LmTest) – A new test to run based on the result of this test.

get_new_tests()[source]

Get the new tests generated by the current test.

Returns

A list of newly generated tests.

Return type

list of LmTest

static run_test()[source]

Run the test.

Raises

LmTestFailure – Raised if the test fails.

exception lmtest.base.test_base.LmTestFailure[source]

Bases: Exception

Exception class to raise when a test fails.

exception lmtest.base.test_base.LmTestWarning[source]

Bases: Warning

Warning class to raise when a test ends in a warning status.

lmtest.base.test_finder module

Module containing tools for finding and importing tests.

lmtest.base.test_finder.find_tests(test_dir)[source]

Find tests specified in JSON files in test_dir.

Parameters

test_dir (str) – Directory containing JSON test configuration files.

Returns

A list of LmTest testing objects.

Return type

list

Module contents

Package containing base classes for lmtest.