toil.test.server.serverTest

Attributes

logger

Classes

ToilTest

A common base class for Toil tests.

ToilServerUtilsTest

Tests for the utility functions used by the Toil server.

hidden

FileStateStoreTest

Test file-based state storage.

FileStateStoreURLTest

Test file-based state storage using URLs instead of local paths.

BucketUsingTest

Base class for tests that need a bucket.

AWSStateStoreTest

Test AWS-based state storage.

AbstractToilWESServerTest

Class for server tests that provides a self.app in testing mode.

ToilWESServerBenchTest

Tests for Toil's Workflow Execution Service API that don't run workflows.

ToilWESServerWorkflowTest

Tests of the WES server running workflows.

ToilWESServerCeleryWorkflowTest

End-to-end workflow-running tests against Celery.

ToilWESServerCeleryS3StateWorkflowTest

Test the server with Celery and state stored in S3.

Functions

needs_aws_s3(test_item)

Use as a decorator before test classes or methods to run only if AWS S3 is usable.

needs_celery_broker(test_item)

Use as a decorator before test classes or methods to run only if RabbitMQ is set up to take Celery jobs.

needs_server(test_item)

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

Module Contents

class toil.test.server.serverTest.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.server.serverTest.needs_aws_s3(test_item)[source]

Use as a decorator before test classes or methods to run only if AWS S3 is usable.

Parameters:

test_item (MT)

Return type:

MT

toil.test.server.serverTest.needs_celery_broker(test_item)[source]

Use as a decorator before test classes or methods to run only if RabbitMQ is set up to take Celery jobs.

Parameters:

test_item (MT)

Return type:

MT

toil.test.server.serverTest.needs_server(test_item)[source]

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

Parameters:

test_item (MT)

Return type:

MT

toil.test.server.serverTest.logger
class toil.test.server.serverTest.ToilServerUtilsTest(methodName='runTest')[source]

Bases: toil.test.ToilTest

Tests for the utility functions used by the Toil server.

test_workflow_canceling_recovery()[source]

Make sure that a workflow in CANCELING state will be recovered to a terminal state eventually even if the workflow runner Celery task goes away without flipping the state.

class toil.test.server.serverTest.hidden[source]
class AbstractStateStoreTest(methodName='runTest')[source]

Bases: toil.test.ToilTest

Basic tests for state stores.

abstract get_state_store()[source]

Make a state store to test, on a single fixed URL.

Return type:

AbstractStateStore

test_state_store()[source]

Make sure that the state store under test can store and load keys.

Return type:

None

class toil.test.server.serverTest.FileStateStoreTest(methodName='runTest')[source]

Bases: hidden

Test file-based state storage.

setUp()[source]

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

Return type:

None

get_state_store()[source]

Make a state store to test, on a single fixed local path.

Return type:

AbstractStateStore

class toil.test.server.serverTest.FileStateStoreURLTest(methodName='runTest')[source]

Bases: hidden

Test file-based state storage using URLs instead of local paths.

setUp()[source]

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

Return type:

None

get_state_store()[source]

Make a state store to test, on a single fixed URL.

Return type:

AbstractStateStore

class toil.test.server.serverTest.BucketUsingTest(methodName='runTest')[source]

Bases: toil.test.ToilTest

Base class for tests that need a bucket.

region: str | None
s3_resource: mypy_boto3_s3.S3ServiceResource | None
bucket: mypy_boto3_s3.service_resource.Bucket | None
bucket_name: str | None
classmethod setUpClass()[source]

Set up the class with a single pre-existing AWS bucket for all tests.

Return type:

None

classmethod tearDownClass()[source]

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

Return type:

None

class toil.test.server.serverTest.AWSStateStoreTest(methodName='runTest')[source]

Bases: hidden, BucketUsingTest

Test AWS-based state storage.

bucket_path = 'prefix/of/keys'
get_state_store()[source]

Make a state store to test, on a single fixed URL.

Return type:

AbstractStateStore

test_state_store_paths()[source]

Make sure that the S3 state store puts things in the right places.

We don’t really care about the exact internal structure, but we do care about actually being under the path we are supposed to use.

Return type:

None

class toil.test.server.serverTest.AbstractToilWESServerTest(*args, **kwargs)[source]

Bases: toil.test.ToilTest

Class for server tests that provides a self.app in testing mode.

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

class toil.test.server.serverTest.ToilWESServerBenchTest(*args, **kwargs)[source]

Bases: AbstractToilWESServerTest

Tests for Toil’s Workflow Execution Service API that don’t run workflows.

test_home()[source]

Test the homepage endpoint.

Return type:

None

test_health()[source]

Test the health check endpoint.

Return type:

None

test_get_service_info()[source]

Test the GET /service-info endpoint.

Return type:

None

class toil.test.server.serverTest.ToilWESServerWorkflowTest(*args, **kwargs)[source]

Bases: AbstractToilWESServerTest

Tests of the WES server running workflows.

run_zip_workflow(zip_path, include_message=True, include_params=True)[source]

We have several zip file tests; this submits a zip file and makes sure it ran OK.

If include_message is set to False, don’t send a “message” argument in workflow_params. If include_params is also set to False, don’t send workflow_params at all.

Parameters:
  • zip_path (str)

  • include_message (bool)

  • include_params (bool)

Return type:

None

test_run_workflow_relative_url_no_attachments_fails()[source]

Test run example CWL workflow from relative workflow URL but with no attachments.

Return type:

None

test_run_workflow_relative_url()[source]

Test run example CWL workflow from relative workflow URL.

Return type:

None

test_run_workflow_https_url()[source]

Test run example CWL workflow from the Internet.

Return type:

None

test_run_workflow_single_file_zip()[source]

Test run example CWL workflow from single-file ZIP.

Return type:

None

test_run_workflow_multi_file_zip()[source]

Test run example CWL workflow from multi-file ZIP.

Return type:

None

test_run_workflow_manifest_zip()[source]

Test run example CWL workflow from ZIP with manifest.

Return type:

None

test_run_workflow_inputs_zip()[source]

Test run example CWL workflow from ZIP without manifest but with inputs.

Return type:

None

test_run_workflow_manifest_and_inputs_zip()[source]

Test run example CWL workflow from ZIP with manifest and inputs.

Return type:

None

test_run_workflow_no_params_zip()[source]

Test run example CWL workflow from ZIP without workflow_params.

Return type:

None

test_run_and_cancel_workflows()[source]

Run two workflows, cancel one of them, and make sure they all exist.

Return type:

None

class toil.test.server.serverTest.ToilWESServerCeleryWorkflowTest(*args, **kwargs)[source]

Bases: ToilWESServerWorkflowTest

End-to-end workflow-running tests against Celery.

class toil.test.server.serverTest.ToilWESServerCeleryS3StateWorkflowTest(*args, **kwargs)[source]

Bases: ToilWESServerWorkflowTest, BucketUsingTest

Test the server with Celery and state stored in S3.

setUp()[source]

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

Return type:

None