mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
IntegrationTestCases differ from functional tests in that they start up a Galaxy instance configured on a per test class basis - so this new class of "integration tests" can test configuration modalities of Galaxy that cannot be tested with traditional Galaxy functional tests.
64 lines
2.0 KiB
Python
64 lines
2.0 KiB
Python
"""Utilities for constructing Galaxy integration tests.
|
|
|
|
Tests that start an actual Galaxy server with a particular configuration in
|
|
order to test something that cannot be tested with the default functional/api
|
|
tessting configuration.
|
|
"""
|
|
|
|
from .driver_util import GalaxyTestDriver
|
|
from unittest import TestCase
|
|
|
|
NO_APP_MESSAGE = "test_case._app called though no Galaxy has been configured."
|
|
|
|
|
|
class IntegrationTestCase(TestCase):
|
|
"""Unit test case with utilities for spinning up Galaxy."""
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
"""Configure and start Galaxy for a test."""
|
|
cls._app_available = False
|
|
cls._test_driver = GalaxyTestDriver()
|
|
cls._prepare_galaxy()
|
|
cls._test_driver.setup(config_object=cls)
|
|
cls._app_available = True
|
|
cls._configure_app()
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
"""Shutdown Galaxy server and cleanup temp directory."""
|
|
cls._test_driver.tear_down()
|
|
cls._app_available = False
|
|
|
|
@property
|
|
def _app(self):
|
|
assert self._app_available, NO_APP_MESSAGE
|
|
return self._test_driver.app
|
|
|
|
@property
|
|
def _tempdir(self):
|
|
return self._test_driver.galaxy_test_tmp_dir
|
|
|
|
@classmethod
|
|
def _prepare_galaxy(cls):
|
|
"""Extension point for subclasses called before Galaxy is launched."""
|
|
|
|
@classmethod
|
|
def _configure_app(cls):
|
|
"""Extension point for subclasses called after Galaxy is launched.
|
|
|
|
```self._app``` can be used to access Galaxy core app.
|
|
"""
|
|
|
|
@classmethod
|
|
def handle_galaxy_config_kwds(cls, galaxy_config_kwds):
|
|
"""Extension point for subclasses to modify arguments used to configure Galaxy.
|
|
|
|
This method will be passed the keyword argument pairs used to call
|
|
Galaxy Config object and can modify the Galaxy instance created for
|
|
the test as needed.
|
|
"""
|
|
|
|
def _run_tool_test(self, *args, **kwargs):
|
|
return self._test_driver.run_tool_test(*args, **kwargs)
|