ample.testing.integration_util module

Module containing a framework for integration testing of AMPLE modules

class AMPLEBaseTest(methodName=’runTest’)[source]

Bases: unittest.case.TestCase

Attributes:
AMPLE_DICT
RESULTS_PKL

Methods

addCleanup(function, *args, **kwargs) Add a function, with arguments, to be called when the test is completed.
addTypeEqualityFunc(typeobj, function) Add a type specific assertEqual style function to compare a type.
assertAlmostEqual(first, second[, places, …]) Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is more than the given delta.
assertAlmostEquals(first, second[, places, …]) Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is more than the given delta.
assertDictContainsSubset(expected, actual[, msg]) Checks whether actual is a superset of expected.
assertEqual(first, second[, msg]) Fail if the two objects are unequal as determined by the ‘==’ operator.
assertEquals(first, second[, msg]) Fail if the two objects are unequal as determined by the ‘==’ operator.
assertFalse(expr[, msg]) Check that the expression is false.
assertGreater(a, b[, msg]) Just like self.assertTrue(a > b), but with a nicer default message.
assertGreaterEqual(a, b[, msg]) Just like self.assertTrue(a >= b), but with a nicer default message.
assertIn(member, container[, msg]) Just like self.assertTrue(a in b), but with a nicer default message.
assertIs(expr1, expr2[, msg]) Just like self.assertTrue(a is b), but with a nicer default message.
assertIsInstance(obj, cls[, msg]) Same as self.assertTrue(isinstance(obj, cls)), with a nicer default message.
assertIsNone(obj[, msg]) Same as self.assertTrue(obj is None), with a nicer default message.
assertIsNot(expr1, expr2[, msg]) Just like self.assertTrue(a is not b), but with a nicer default message.
assertIsNotNone(obj[, msg]) Included for symmetry with assertIsNone.
assertItemsEqual(expected_seq, actual_seq[, msg]) An unordered sequence specific comparison.
assertLess(a, b[, msg]) Just like self.assertTrue(a < b), but with a nicer default message.
assertLessEqual(a, b[, msg]) Just like self.assertTrue(a <= b), but with a nicer default message.
assertListEqual(list1, list2[, msg]) A list-specific equality assertion.
assertMultiLineEqual(first, second[, msg]) Assert that two multi-line strings are equal.
assertNotAlmostEqual(first, second[, …]) Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is less than the given delta.
assertNotAlmostEquals(first, second[, …]) Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is less than the given delta.
assertNotEqual(first, second[, msg]) Fail if the two objects are equal as determined by the ‘!=’ operator.
assertNotEquals(first, second[, msg]) Fail if the two objects are equal as determined by the ‘!=’ operator.
assertNotIn(member, container[, msg]) Just like self.assertTrue(a not in b), but with a nicer default message.
assertNotIsInstance(obj, cls[, msg]) Included for symmetry with assertIsInstance.
assertNotRegexpMatches(text, unexpected_regexp) Fail the test if the text matches the regular expression.
assertRaises(excClass[, callableObj]) Fail unless an exception of class excClass is raised by callableObj when invoked with arguments args and keyword arguments kwargs.
assertRaisesRegexp(expected_exception, …) Asserts that the message in a raised exception matches a regexp.
assertRegexpMatches(text, expected_regexp[, msg]) Fail the test unless the text matches the regular expression.
assertSequenceEqual(seq1, seq2[, msg, seq_type]) An equality assertion for ordered sequences (like lists and tuples).
assertSetEqual(set1, set2[, msg]) A set-specific equality assertion.
assertTrue(expr[, msg]) Check that the expression is true.
assertTupleEqual(tuple1, tuple2[, msg]) A tuple-specific equality assertion.
assert_(expr[, msg]) Check that the expression is true.
debug() Run the test without collecting errors in a TestResult
doCleanups() Execute all cleanup functions.
fail([msg]) Fail immediately, with the given message.
failureException alias of AssertionError
setUpClass() Hook method for setting up class fixture before running tests in the class.
shortDescription() Returns a one-line description of the test, or None if no description has been provided.
skipTest(reason) Skip this test.
tearDown() Hook method for deconstructing the test fixture after testing it.
tearDownClass() Hook method for deconstructing the class fixture after running all tests in the class.
__call__  
assertDictEqual  
countTestCases  
defaultTestResult  
failIf  
failIfAlmostEqual  
failIfEqual  
failUnless  
failUnlessAlmostEqual  
failUnlessEqual  
failUnlessRaises  
id  
run  
setUp  
AMPLE_DICT = None
RESULTS_PKL = None
setUp()[source]
class AMPLEIntegrationFramework(test_cases=None, run_dir=None)[source]

Bases: object

Framework to run Ample integration testing

Methods

run([nproc, dry_run, clean_up, rosetta_dir]) Run the integration testing jobs and then the unittests to test them.
write_script(work_dir, args, ensembler) Write script
clean  
get_run_dir  
run_unittest_suite  
clean(clean_all=True, clean_dir=False)[source]
get_run_dir()[source]
run(nproc=1, dry_run=False, clean_up=True, rosetta_dir=None, **kwargs)[source]

Run the integration testing jobs and then the unittests to test them.

In all cases jobs are run on a single processor. For running on a cluster, the ample job scripts have the queue directives added to them, and each ample job is launched on the head node. The individual jobs then submit their various job stages to the queue and the integration test job just manages running all the individual ample jobs until they have finished. Although this means lots of jobs running on the head node, the actual computation done on the head node should be minimal as all processing is submitted to the queue.

Previously when running on a cluster we created a single single-processor serial ample script for each job and then submitted a single array job to run all the jobs on the cluster. This approach had to be abandoned as (I think) the individual jobs timed out.

run_unittest_suite()[source]
write_script(work_dir, args, ensembler)[source]

Write script

class SuiteLoader[source]

Bases: object

Loader designed to obtain all test cases in a package

Methods

load_cases(directory[, test_cases, pattern]) function to load a integration test suite
load_module  
load_cases(directory, test_cases=None, pattern=’test_cases’)[source]

function to load a integration test suite

load_module(mod_name, paths)[source]
add_cmd_options(parser)[source]