Files
John ChiltonandClaude Opus 5.5 a8f39f2ba5 Move API test code shared with other suites to galaxy_test.base
Integration tests, framework tests and lib/galaxy_test/conftest.py
imported ApiTestCase, tool/workflow/history mixins and sample sheet
helpers from API test modules. Move them to galaxy_test.base;
api/_framework.py re-exports ApiTestCase for the API tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:36:21 -04:00

40 lines
1.1 KiB
Python

from collections.abc import Iterator
from unittest import SkipTest
import pytest
from galaxy_test.base.api import (
UsesApiTestCaseMixin,
UsesCeleryTasks,
)
from galaxy_test.base.testcase import FunctionalTestCase
try:
from galaxy_test.driver.driver_util import GalaxyTestDriver
except ImportError:
# Galaxy libraries and galaxy test driver not available, just assume we're
# targetting a remote Galaxy.
GalaxyTestDriver = None # type: ignore[assignment, misc, unused-ignore]
class ApiTestCase(FunctionalTestCase, UsesApiTestCaseMixin, UsesCeleryTasks):
galaxy_driver_class = GalaxyTestDriver
_test_driver: "GalaxyTestDriver | None"
def setUp(self):
super().setUp()
self._setup_interactor()
def driver_or_skip_test_if_remote(self) -> GalaxyTestDriver:
if self._test_driver is None:
raise SkipTest("This test does not work with remote Galaxy instances.")
return self._test_driver
@pytest.fixture
def history_id(self) -> Iterator[str]:
with self.galaxy_interactor.test_history() as history_id:
yield history_id
__all__ = ("ApiTestCase",)