Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
galaxy_test.base package¶
Submodules¶
galaxy_test.base.api module¶
-
class
galaxy_test.base.api.
ApiTestInteractor
(test_case, api_key=None)[source]¶ Bases:
galaxy_test.base.interactor.TestCaseGalaxyInteractor
Specialized variant of the API interactor (originally developed for tool functional tests) for testing the API generally.
galaxy_test.base.api_asserts module¶
Utility methods for making assertions about Galaxy API responses, etc…
-
galaxy_test.base.api_asserts.
assert_status_code_is
(response: requests.models.Response, expected_status_code: int)[source]¶ Assert that the supplied response has the expect status code.
-
galaxy_test.base.api_asserts.
assert_status_code_is_ok
(response: requests.models.Response)[source]¶ Assert that the supplied response is okay.
The easier alternative
response.raise_for_status()
might be perferable generally.See also
-
galaxy_test.base.api_asserts.
assert_has_keys
(response: dict, *keys: str)[source]¶ Assert that the supplied response (dict) has the supplied keys.
-
galaxy_test.base.api_asserts.
assert_not_has_keys
(response: dict, *keys: str)[source]¶ Assert that the supplied response (dict) does not have the supplied keys.
-
galaxy_test.base.api_asserts.
assert_error_code_is
(response: Union[requests.models.Response, dict], error_code: int)[source]¶ Assert that the supplied response has the supplied Galaxy error code.
Galaxy error codes can be imported from
galaxy.exceptions.error_codes
to test against.from galaxy.exceptions import error_codes assert_error_code_is(response, error_codes.USER_REQUEST_MISSING_PARAMETER)
-
galaxy_test.base.api_asserts.
assert_object_id_error
(response: requests.models.Response)[source]¶
-
galaxy_test.base.api_asserts.
assert_error_message_contains
(response: Union[requests.models.Response, dict], expected_contains: str)[source]¶
galaxy_test.base.api_util module¶
galaxy_test.base.constants module¶
Just constants useful for testing across test types.
galaxy_test.base.env module¶
Base utilities for working Galaxy test environments.
galaxy_test.base.instrument module¶
Utilities to help instrument tool tests.
Including structured data nose plugin that allows storing arbitrary structured data on a per test case basis - used by tool test to store inputs, output problems, job tests, etc… but could easily by used by other test types in a different way.
-
class
galaxy_test.base.instrument.
StructuredTestDataPlugin
[source]¶ Bases:
nose.plugins.base.Plugin
-
name
= 'structureddata'¶
-
options
(parser, env)[source]¶ Register commandline options.
Implement this method for normal options behavior with protection from OptionConflictErrors. If you override this method and want the default –with-$name option to be registered, be sure to call super().
-
configure
(options, conf)[source]¶ Configure the plugin and system, based on selected options.
The base plugin class sets the plugin to enabled if the enable option for the plugin (self.enableOpt) is true.
-
addError
(test, *args, **kwds)¶
-
addFailure
(test, *args, **kwds)¶
-
addSuccess
(test, *args, **kwds)¶
-
galaxy_test.base.interactor module¶
-
class
galaxy_test.base.interactor.
TestCaseGalaxyInteractor
(functional_test_case, test_user=None, api_key=None)[source]¶ Bases:
galaxy.tool_util.verify.interactor.GalaxyInteractorApi
galaxy_test.base.nose_util module¶
Utilities for dealing with nose.
There was some duplication between Galaxy, Tool Shed, and Install/Test, trying to reduce that here.
galaxy_test.base.populators module¶
-
galaxy_test.base.populators.
skip_without_tool
(tool_id)[source]¶ Decorate an API test method as requiring a specific tool.
Have test framework skip the test case if the tool is unavailable.
-
galaxy_test.base.populators.
skip_without_datatype
(extension)[source]¶ Decorate an API test method as requiring a specific datatype.
Have test framework skip the test case if the datatype is unavailable.
-
galaxy_test.base.populators.
skip_if_toolshed_down
(method)¶
-
galaxy_test.base.populators.
skip_if_github_down
(method)¶
-
galaxy_test.base.populators.
uses_test_history
(**test_history_kwd)[source]¶ Can override require_new and cancel_executions using kwds to decorator.
-
class
galaxy_test.base.populators.
BaseDatasetPopulator
[source]¶ Bases:
object
Abstract description of API operations optimized for testing Galaxy - implementations must implement _get, _post and _delete.
-
get_history_dataset_content
(history_id, wait=True, filename=None, type='text', raw=False, **kwds)[source]¶
-
-
class
galaxy_test.base.populators.
BaseWorkflowPopulator
[source]¶ Bases:
object
-
load_workflow
(name, content='{\n "a_galaxy_workflow": "true", \n "annotation": "simple workflow",\n "format-version": "0.1", \n "name": "TestWorkflow1", \n "steps": {\n "0": {\n "annotation": "input1 description", \n "id": 0, \n "input_connections": {}, \n "inputs": [\n {\n "description": "input1 description", \n "name": "WorkflowInput1"\n }\n ], \n "name": "Input dataset", \n "outputs": [], \n "position": {\n "left": 199.55555772781372, \n "top": 200.66666460037231\n }, \n "tool_errors": null, \n "tool_id": null, \n "tool_state": "{\\"name\\": \\"WorkflowInput1\\"}", \n "tool_version": null, \n "type": "data_input", \n "user_outputs": []\n }, \n "1": {\n "annotation": "", \n "id": 1, \n "input_connections": {}, \n "inputs": [\n {\n "description": "", \n "name": "WorkflowInput2"\n }\n ], \n "name": "Input dataset", \n "outputs": [], \n "position": {\n "left": 206.22221422195435, \n "top": 327.33335161209106\n }, \n "tool_errors": null, \n "tool_id": null, \n "tool_state": "{\\"name\\": \\"WorkflowInput2\\"}", \n "tool_version": null, \n "type": "data_input", \n "user_outputs": []\n }, \n "2": {\n "annotation": "", \n "id": 2, \n "input_connections": {\n "input1": {\n "id": 0, \n "output_name": "output"\n }, \n "queries_0|input2": {\n "id": 1, \n "output_name": "output"\n }\n }, \n "inputs": [], \n "name": "Concatenate datasets", \n "outputs": [\n {\n "name": "out_file1", \n "type": "input"\n }\n ], \n "position": {\n "left": 419.33335876464844, \n "top": 200.44446563720703\n }, \n "post_job_actions": {}, \n "tool_errors": null, \n "tool_id": "cat1", \n "tool_state": "{\\"__page__\\": 0, \\"__rerun_remap_job_id__\\": null, \\"input1\\": \\"null\\", \\"queries\\": \\"[{\\\\\\"input2\\\\\\": null, \\\\\\"__index__\\\\\\": 0}]\\"}", \n "tool_version": "1.0.0", \n "type": "tool", \n "user_outputs": []\n }\n }\n}\n', add_pja=False)[source]¶
-
wait_for_history_workflows
(history_id, assert_ok=True, timeout=60, expected_invocation_count=None)[source]¶
-
wait_for_workflow
(workflow_id, invocation_id, history_id, assert_ok=True, timeout=60)[source]¶ Wait for a workflow invocation to completely schedule and then history to be complete.
-
validate_biocompute_object
(bco, expected_schema_version='https://w3id.org/ieee/ieee-2791-schema/2791object.json')[source]¶
-
run_workflow
(has_workflow, test_data=None, history_id=None, wait=True, source_type=None, jobs_descriptions=None, expected_response=200, assert_ok=True, client_convert=None, round_trip_format_conversion=False, raw_yaml=False)[source]¶ High-level wrapper around workflow API, etc. to invoke format 2 workflows.
-
-
class
galaxy_test.base.populators.
RunJobsSummary
(history_id, workflow_id, invocation_id, inputs, jobs, invocation, workflow_request)¶ Bases:
tuple
-
property
history_id
¶ Alias for field number 0
-
property
inputs
¶ Alias for field number 3
-
property
invocation
¶ Alias for field number 5
-
property
invocation_id
¶ Alias for field number 2
-
property
jobs
¶ Alias for field number 4
-
property
workflow_id
¶ Alias for field number 1
-
property
workflow_request
¶ Alias for field number 6
-
property
-
class
galaxy_test.base.populators.
WorkflowPopulator
(galaxy_interactor)[source]¶ Bases:
galaxy_test.base.populators.BaseWorkflowPopulator
,gxformat2.interface.ImporterGalaxyInterface
-
class
galaxy_test.base.populators.
BaseDatasetCollectionPopulator
[source]¶ Bases:
object
-
class
galaxy_test.base.populators.
DatasetCollectionPopulator
(galaxy_interactor)[source]¶ Bases:
galaxy_test.base.populators.BaseDatasetCollectionPopulator
-
galaxy_test.base.populators.
load_data_dict
(history_id, test_data, dataset_populator, dataset_collection_populator)[source]¶ Load a dictionary as inputs to a workflow (test data focused).
-
galaxy_test.base.populators.
stage_inputs
(galaxy_interactor, history_id, job, use_path_paste=True, use_fetch_api=True, to_posix_lines=True)[source]¶ Alternative to load_data_dict that uses production-style workflow inputs.
-
galaxy_test.base.populators.
stage_rules_example
(galaxy_interactor, history_id, example)[source]¶ Wrapper around stage_inputs for staging collections defined by rules spec DSL.
-
galaxy_test.base.populators.
wait_on_state
(state_func, desc='state', skip_states=None, ok_states=None, assert_ok=False, timeout=60)[source]¶
-
class
galaxy_test.base.populators.
GiPostGetMixin
[source]¶ Bases:
object
Mixin for adapting Galaxy testing populators helpers to bioblend.
-
class
galaxy_test.base.populators.
GiDatasetPopulator
(gi)[source]¶ Bases:
galaxy_test.base.populators.BaseDatasetPopulator
,galaxy_test.base.populators.GiPostGetMixin
Implementation of BaseDatasetPopulator backed by bioblend.
-
class
galaxy_test.base.populators.
GiDatasetCollectionPopulator
(gi)[source]¶ Bases:
galaxy_test.base.populators.BaseDatasetCollectionPopulator
,galaxy_test.base.populators.GiPostGetMixin
Implementation of BaseDatasetCollectionPopulator backed by bioblend.
-
class
galaxy_test.base.populators.
GiWorkflowPopulator
(gi)[source]¶ Bases:
galaxy_test.base.populators.BaseWorkflowPopulator
,galaxy_test.base.populators.GiPostGetMixin
Implementation of BaseWorkflowPopulator backed by bioblend.
galaxy_test.base.rules_test_data module¶
galaxy_test.base.ssh_util module¶
galaxy_test.base.testcase module¶
-
class
galaxy_test.base.testcase.
FunctionalTestCase
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Base class for tests targetting actual Galaxy servers.
Subclass should override galaxy_driver_class if a Galaxy server needs to be launched to run the test, this base class assumes a server is already running.