Commit 78da479d authored by John Chilton's avatar John Chilton
Browse files

typing fixes for integration testing framework stuff...

I wonder if there is a better way to model mixins - seems heavy to annotate everything we need from the derived class.
parent 8412cb53
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -621,7 +621,7 @@ def setup_shed_tools_for_test(app, tmpdir, testing_migrated_tools, testing_insta
        app.toolbox = tools.ToolBox(tool_configs, app.config.tool_path, app)


def build_galaxy_app(simple_kwargs):
def build_galaxy_app(simple_kwargs) -> GalaxyUniverseApplication:
    """Build a Galaxy app object from a simple keyword arguments.

    Construct paste style complex dictionary and use load_app_properties so
+8 −2
Original line number Diff line number Diff line
@@ -5,10 +5,12 @@ order to test something that cannot be tested with the default functional/api
testing configuration.
"""
import os
from typing import ClassVar
from unittest import skip, SkipTest, TestCase

import pytest

from galaxy.app import UniverseApplication
from galaxy.tool_util.verify.test_data import TestDataResolver
from galaxy.util.commands import which
from galaxy_test.base.api import UsesApiTestCaseMixin
@@ -79,6 +81,8 @@ class IntegrationInstance(UsesApiTestCaseMixin):
    """Unit test case with utilities for spinning up Galaxy."""
    _test_driver: GalaxyTestDriver  # Optional in parent class, but required for integration tests.

    _app_available: ClassVar[bool]

    prefer_template_database = True
    # Subclasses can override this to force uwsgi for tests.
    require_uwsgi = False
@@ -121,9 +125,11 @@ class IntegrationInstance(UsesApiTestCaseMixin):
        self._configure_interactor()

    @property
    def _app(self):
    def _app(self) -> UniverseApplication:
        assert self._app_available, NO_APP_MESSAGE
        return self._test_driver.app
        app = self._test_driver.app
        assert app, NO_APP_MESSAGE
        return app

    @property
    def _tempdir(self):
+0 −4
Original line number Diff line number Diff line
@@ -763,10 +763,6 @@ check_untyped_defs = False
check_untyped_defs = False
[mypy-tool_shed.test.base.test_db_util]
check_untyped_defs = False
[mypy-galaxy_test.driver.integration_util]
check_untyped_defs = False
[mypy-integration.uses_shed]
check_untyped_defs = False
[mypy-integration.test_save_job_id_on_datasets]
check_untyped_defs = False
[mypy-integration.test_config_defaults]
+16 −4
Original line number Diff line number Diff line
@@ -2,12 +2,16 @@ import os
import shutil
import string
import tempfile
from typing import ClassVar

import pytest

from galaxy.app import UniverseApplication
from galaxy.tool_util.verify.interactor import GalaxyInteractorApi
from galaxy.util import unicodify
from galaxy_test.base.api_asserts import assert_status_code_is
from galaxy_test.base.populators import DEFAULT_TIMEOUT
from galaxy_test.driver.driver_util import FRAMEWORK_UPLOAD_TOOL_CONF
from galaxy_test.driver.driver_util import FRAMEWORK_UPLOAD_TOOL_CONF, GalaxyTestDriver


# Needs a longer timeout because of the conda_auto_install.
@@ -30,6 +34,14 @@ SHED_DATA_TABLES = """<?xml version="1.0"?>


class UsesShed:
    @property
    def _app(self) -> UniverseApplication:
        ...
    shed_tools_dir: ClassVar[str]
    shed_tool_data_dir: ClassVar[str]
    conda_tmp_prefix: ClassVar[str]
    galaxy_interactor: GalaxyInteractorApi
    _test_driver: GalaxyTestDriver

    @classmethod
    def configure_shed(cls, config):
@@ -84,10 +96,10 @@ class UsesShed:
        model.context.flush()

    def delete_repo_request(self, payload):
        return self._delete('/tool_shed_repositories', data=payload, admin=True)
        return self.galaxy_interactor._delete('/tool_shed_repositories', data=payload, admin=True)

    def install_repo_request(self, payload):
        return self._post('/tool_shed_repositories/new/install_repository_revision', data=payload, admin=True)
        return self.galaxy_interactor._post('/tool_shed_repositories/new/install_repository_revision', data=payload, admin=True)

    def repository_operation(self, operation, owner, name, changeset, tool_shed_url='https://toolshed.g2.bx.psu.edu'):
        payload = {
@@ -97,7 +109,7 @@ class UsesShed:
            'changeset_revision': changeset
        }
        create_response = operation(payload)
        self._assert_status_code_is(create_response, 200)
        assert_status_code_is(create_response, 200)
        return create_response.json()

    def install_repository(self, owner, name, changeset, tool_shed_url='https://toolshed.g2.bx.psu.edu'):