toil.test.utils.toilDebugTest

Attributes

python

logger

Classes

ToilTest

A common base class for Toil tests.

DebugJobTest

Test the toil debug-job command.

Functions

glob(glob_pattern, directoryname)

Walks through a directory and its subdirectories looking for files matching

slow(test_item)

Use this decorator to identify tests that are slow and not critical.

needs_wdl(test_item)

Use as a decorator before test classes or methods to only run them if miniwdl is installed

workflow_debug_jobstore()

testJobStoreContents()

Test toilDebugFile.printContentsOfJobStore().

fetchFiles(symLink, jobStoreDir, outputDir)

Fn for testFetchJobStoreFiles() and testFetchJobStoreFilesWSymlinks().

testFetchJobStoreFiles()

Test toilDebugFile.fetchJobStoreFiles() symlinks.

Module Contents

class toil.test.utils.toilDebugTest.ToilTest(methodName='runTest')[source]

Bases: unittest.TestCase

A common base class for Toil tests.

Please have every test case directly or indirectly inherit this one.

When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.

setup_method(method)[source]
Parameters:

method (Any)

Return type:

None

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

Return type:

None

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

Return type:

None

setUp()[source]

Hook method for setting up the test fixture before exercising it.

Return type:

None

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

Return type:

None

classmethod awsRegion()[source]

Pick an appropriate AWS region.

Use us-west-2 unless running on EC2, in which case use the region in which the instance is located

Return type:

str

toil.test.utils.toilDebugTest.glob(glob_pattern, directoryname)[source]

Walks through a directory and its subdirectories looking for files matching the glob_pattern and returns a list=[].

Parameters:
  • directoryname (str) – Any accessible folder name on the filesystem.

  • glob_pattern (str) – A string like *.txt, which would find all text files.

Returns:

A list=[] of absolute filepaths matching the glob pattern.

Return type:

List[str]

toil.test.utils.toilDebugTest.slow(test_item)[source]

Use this decorator to identify tests that are slow and not critical. Skip if TOIL_TEST_QUICK is true.

Parameters:

test_item (MT)

Return type:

MT

toil.test.utils.toilDebugTest.needs_wdl(test_item)[source]

Use as a decorator before test classes or methods to only run them if miniwdl is installed and configured.

Parameters:

test_item (MT)

Return type:

MT

toil.test.utils.toilDebugTest.python = 'python3.9'
toil.test.utils.toilDebugTest.logger
toil.test.utils.toilDebugTest.workflow_debug_jobstore()[source]
Return type:

str

toil.test.utils.toilDebugTest.testJobStoreContents()[source]

Test toilDebugFile.printContentsOfJobStore().

Runs a workflow that imports ‘B.txt’ and ‘mkFile.py’ into the jobStore. ‘A.txt’, ‘C.txt’, ‘ABC.txt’ are then created. This checks to make sure these contents are found in the jobStore and printed.

toil.test.utils.toilDebugTest.fetchFiles(symLink, jobStoreDir, outputDir)[source]

Fn for testFetchJobStoreFiles() and testFetchJobStoreFilesWSymlinks().

Runs a workflow that imports ‘B.txt’ and ‘mkFile.py’ into the jobStore. ‘A.txt’, ‘C.txt’, ‘ABC.txt’ are then created. This test then attempts to get a list of these files and copy them over into our output diectory from the jobStore, confirm that they are present, and then delete them.

Parameters:
  • symLink (bool)

  • jobStoreDir (str)

  • outputDir (str)

toil.test.utils.toilDebugTest.testFetchJobStoreFiles()[source]

Test toilDebugFile.fetchJobStoreFiles() symlinks.

Return type:

None

class toil.test.utils.toilDebugTest.DebugJobTest(methodName='runTest')[source]

Bases: toil.test.ToilTest

Test the toil debug-job command.

test_run_job()[source]

Make sure that we can use toil debug-job to try and run a job in-process.

test_print_job_info()[source]

Make sure that we can use –printJobInfo to get information on a job from a job store.

test_retrieve_task_directory()[source]

Make sure that we can use –retrieveTaskDirectory to get the input files for a job.