Skip to content

Commit

Permalink
Move galaxy testing utilities into more sane package structure.
Browse files Browse the repository at this point in the history
Split test/base into lib/galaxy_test/base and lib/galaxy_test/driver. Dividing things on whether they import galaxy-app code or not - with the goal of a galaxy-test-base package that doesn't depend on galaxy-app and a galaxy-test-driver package that does.

I've been refactoring around this division for a long time. Certain tests (namely the integration tests) always need to bootstrap Galaxy - but the API tests and the Selenium tests should be installable and runnable without Galaxy in the Python environment. So future galaxy-test-api and galaxy-test-selenium packages should have only an optional dependency on galaxy-test-driver.

Properly sturcturing these namespaces is a precursor for real packages on PyPI, clean separation of the tool shed testing code, and cleans up all the flake8 noqa hacks in test/.
  • Loading branch information
jmchilton committed Nov 12, 2019
1 parent 1641dfe commit 45019c3
Show file tree
Hide file tree
Showing 109 changed files with 177 additions and 190 deletions.
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mocha/tests/rules_dsl_spec.yml
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
6 changes: 3 additions & 3 deletions test/base/api.py → lib/galaxy_test/driver/api.py
Expand Up @@ -3,21 +3,21 @@

from six.moves.urllib.parse import urlencode

from .api_asserts import (
from galaxy_test.base.api_asserts import (
assert_error_code_is,
assert_has_keys,
assert_not_has_keys,
assert_status_code_is,
assert_status_code_is_ok,
)
from .api_util import (
from galaxy_test.base.api_util import (
ADMIN_TEST_USER,
get_master_api_key,
get_user_api_key,
OTHER_USER,
TEST_USER,
)
from .interactor import TestCaseGalaxyInteractor as BaseInteractor
from galaxy_test.base.interactor import TestCaseGalaxyInteractor as BaseInteractor
from .testcase import FunctionalTestCase


Expand Down
Expand Up @@ -36,16 +36,16 @@
from galaxy.model import mapping
from galaxy.model.tool_shed_install import mapping as toolshed_mapping
from galaxy.tool_util.verify.interactor import GalaxyInteractorApi, verify_tool
from galaxy.util import asbool, download_to_file
from galaxy.util import asbool, download_to_file, galaxy_directory
from galaxy.util.properties import load_app_properties
from galaxy.web import buildapp
from galaxy_test.base.api_util import get_master_api_key, get_user_api_key
from galaxy_test.base.instrument import StructuredTestDataPlugin
from galaxy_test.base.nose_util import run
from tool_shed.webapp.app import UniverseApplication as ToolshedUniverseApplication
from .api_util import get_master_api_key, get_user_api_key
from .instrument import StructuredTestDataPlugin
from .nose_util import run
from .test_logging import logging_config_file

galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))
galaxy_root = galaxy_directory()
DEFAULT_WEB_HOST = socket.gethostbyname('localhost')
DEFAULT_CONFIG_PREFIX = "GALAXY"
GALAXY_TEST_DIRECTORY = os.path.join(galaxy_root, "test")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/functional_tests.py
Expand Up @@ -12,8 +12,8 @@
galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
sys.path[1:1] = [os.path.join(galaxy_root, "lib"), os.path.join(galaxy_root, "test")]

from base import driver_util
from base.api_util import get_master_api_key, get_user_api_key
from galaxy_test.base.api_util import get_master_api_key, get_user_api_key
from galaxy_test.driver import driver_util

log = driver_util.build_logger()

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -15,4 +15,4 @@ exclude = lib/galaxy/util/jstree.py
# For flake8-import-order
# https://github.com/PyCQA/flake8-import-order/blob/master/tests/test_cases/complete_smarkets.py
import-order-style = smarkets
application-import-names = galaxy,tool_shed
application-import-names = galaxy,galaxy_test,tool_shed
2 changes: 1 addition & 1 deletion test/api/test_api_batch.py
Expand Up @@ -2,7 +2,7 @@

from requests import post

from base import api # noqa: I100,I202
from galaxy_test.driver import api


class ApiBatchTestCase(api.ApiTestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/api/test_authenticate.py
Expand Up @@ -2,7 +2,7 @@

from requests import get

from base import api # noqa: I100,I202
from galaxy_test.driver import api

TEST_USER_EMAIL = "auth_user_test@bx.psu.edu"
TEST_USER_PASSWORD = "testpassword1"
Expand Down
6 changes: 3 additions & 3 deletions test/api/test_configuration.py
@@ -1,11 +1,11 @@
from base import api
from base.api_asserts import (
from galaxy_test.base.api_asserts import (
assert_has_keys,
assert_not_has_keys,
)
from base.populators import (
from galaxy_test.base.populators import (
LibraryPopulator
)
from galaxy_test.driver import api

TEST_KEYS_FOR_ALL_USERS = [
'enable_unique_workflow_defaults',
Expand Down
5 changes: 3 additions & 2 deletions test/api/test_dataset_collections.py
@@ -1,10 +1,11 @@
import json
import tarfile

from base import api
from base.populators import DatasetCollectionPopulator, DatasetPopulator, skip_if_github_down
from six import BytesIO

from galaxy_test.base.populators import DatasetCollectionPopulator, DatasetPopulator, skip_if_github_down
from galaxy_test.driver import api


class DatasetCollectionApiTestCase(api.ApiTestCase):

Expand Down
4 changes: 2 additions & 2 deletions test/api/test_datasets.py
Expand Up @@ -2,11 +2,11 @@

import textwrap

from base import api
from base.populators import (
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
)
from galaxy_test.driver import api


class DatasetsApiTestCase(api.ApiTestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/api/test_datatypes.py
Expand Up @@ -2,7 +2,7 @@

from requests import put

from base import api # noqa: I100,I202
from galaxy_test.driver import api

HIDDEN_DURING_UPLOAD_DATATYPE = "fli"

Expand Down
2 changes: 1 addition & 1 deletion test/api/test_framework.py
@@ -1,6 +1,6 @@
# This file doesn't test any API in particular but is meant to functionally
# test the API framework itself.
from base import api
from galaxy_test.driver import api


class ApiFrameworkTestCase(api.ApiTestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/api/test_galaxy_interactor.py
Expand Up @@ -2,7 +2,7 @@

from packaging.version import Version

from base import api # noqa: I100,I202
from galaxy_test.driver import api


class GalaxyInteractorBackwardCompatTestCase(api.ApiTestCase):
Expand Down
4 changes: 2 additions & 2 deletions test/api/test_histories.py
Expand Up @@ -6,11 +6,11 @@
put
)

from base import api # noqa: I100,I202
from base.populators import ( # noqa: I100
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
)
from galaxy_test.driver import api


class HistoriesApiTestCase(api.ApiTestCase):
Expand Down
4 changes: 2 additions & 2 deletions test/api/test_history_contents.py
Expand Up @@ -4,14 +4,14 @@

from requests import delete, put

from base import api # noqa: I100,I202
from base.populators import ( # noqa: I100
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
LibraryPopulator,
skip_without_tool,
TestsDatasets,
)
from galaxy_test.driver import api


# TODO: Test anonymous access.
Expand Down
4 changes: 2 additions & 2 deletions test/api/test_history_contents_provenance.py
@@ -1,5 +1,5 @@
from base import api
from base.populators import DatasetPopulator
from galaxy_test.base.populators import DatasetPopulator
from galaxy_test.driver import api


class TestProvenance(api.ApiTestCase):
Expand Down
6 changes: 3 additions & 3 deletions test/api/test_jobs.py
Expand Up @@ -6,16 +6,16 @@

import requests

from base import api # noqa: I100,I202
from base.api_asserts import assert_status_code_is_ok # noqa: I100
from base.populators import ( # noqa: I100
from galaxy_test.base.api_asserts import assert_status_code_is_ok
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
skip_without_tool,
uses_test_history,
wait_on,
wait_on_state,
)
from galaxy_test.driver import api


class JobsApiTestCase(api.ApiTestCase):
Expand Down
4 changes: 2 additions & 2 deletions test/api/test_libraries.py
Expand Up @@ -2,13 +2,13 @@
import time
import unittest

from base import api
from base.populators import (
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
LibraryPopulator,
TestsDatasets,
)
from galaxy_test.driver import api

FILE_URL = 'https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/4.bed'
FILE_MD5 = "37b59762b59fff860460522d271bc111"
Expand Down
6 changes: 3 additions & 3 deletions test/api/test_pages.py
@@ -1,8 +1,8 @@
from requests import delete

from base import api # noqa: I100,I202
from base.populators import DatasetPopulator
from galaxy.exceptions import error_codes # noqa: I201
from galaxy.exceptions import error_codes
from galaxy_test.base.populators import DatasetPopulator
from galaxy_test.driver import api


class BasePageApiTestCase(api.ApiTestCase):
Expand Down
6 changes: 3 additions & 3 deletions test/api/test_roles.py
@@ -1,13 +1,13 @@
import json

from base import api
from base.api_asserts import (
from galaxy_test.base.api_asserts import (
assert_has_keys,
assert_status_code_is,
)
from base.populators import ( # noqa: I100
from galaxy_test.base.populators import (
DatasetPopulator,
)
from galaxy_test.driver import api


class RolesApiTestCase(api.ApiTestCase):
Expand Down
5 changes: 3 additions & 2 deletions test/api/test_search.py
@@ -1,7 +1,8 @@
from base import api
from base.populators import WorkflowPopulator
from requests import delete

from galaxy_test.base.populators import WorkflowPopulator
from galaxy_test.driver import api


class SearchApiTestCase(api.ApiTestCase):

Expand Down
2 changes: 1 addition & 1 deletion test/api/test_tool_data.py
Expand Up @@ -4,7 +4,7 @@

import operator

from base import api
from galaxy_test.driver import api


class ToolDataApiTestCase(api.ApiTestCase):
Expand Down
11 changes: 6 additions & 5 deletions test/api/test_tools.py
Expand Up @@ -5,18 +5,19 @@
import tarfile

import pytest
from base import api
from base import rules_test_data
from base.populators import (
from requests import get
from six import BytesIO

from galaxy_test.base import rules_test_data
from galaxy_test.base.populators import (
DatasetCollectionPopulator,
DatasetPopulator,
LibraryPopulator,
load_data_dict,
skip_without_tool,
uses_test_history,
)
from requests import get
from six import BytesIO
from galaxy_test.driver import api


MINIMAL_TOOL = {
Expand Down
9 changes: 4 additions & 5 deletions test/api/test_tools_upload.py
@@ -1,19 +1,18 @@
import json

from base import api
from base.constants import (
from galaxy.tool_util.verify.test_data import TestDataResolver
from galaxy_test.base.constants import (
ONE_TO_SIX_ON_WINDOWS,
ONE_TO_SIX_WITH_SPACES,
ONE_TO_SIX_WITH_TABS,
)
from base.populators import (
from galaxy_test.base.populators import (
DatasetPopulator,
skip_if_site_down,
skip_without_datatype,
uses_test_history,
)

from galaxy.tool_util.verify.test_data import TestDataResolver
from galaxy_test.driver import api


class ToolsUploadTestCase(api.ApiTestCase):
Expand Down
2 changes: 1 addition & 1 deletion test/api/test_tours.py
@@ -1,4 +1,4 @@
from base import api
from galaxy_test.driver import api


class TourApiTestCase(api.ApiTestCase):
Expand Down
4 changes: 2 additions & 2 deletions test/api/test_users.py
Expand Up @@ -6,8 +6,8 @@
put
)

from base import api # noqa: I100,I202
from base.populators import skip_without_tool
from galaxy_test.base.populators import skip_without_tool
from galaxy_test.driver import api

TEST_USER_EMAIL = "user_for_users_index_test@bx.psu.edu"
TEST_USER_EMAIL_DELETE = "user_for_delete_test@bx.psu.edu"
Expand Down
4 changes: 2 additions & 2 deletions test/api/test_visualizations.py
Expand Up @@ -5,8 +5,8 @@
put
)

from base import api # noqa: I100,I202
from base.api_asserts import assert_has_keys # noqa: I100
from galaxy_test.base.api_asserts import assert_has_keys
from galaxy_test.driver import api

INDEX_KEYS = [
'id', 'title', 'type', 'dbkey', 'url'
Expand Down
5 changes: 1 addition & 4 deletions test/api/test_webhooks.py
@@ -1,13 +1,10 @@
from base import api
from base.driver_util import TEST_WEBHOOKS_DIR
from galaxy.webhooks import WebhooksRegistry # noqa: I201
from galaxy_test.driver import api


class WebhooksApiTestCase(api.ApiTestCase):

def setUp(self):
super(WebhooksApiTestCase, self).setUp()
self.webhooks_registry = WebhooksRegistry(TEST_WEBHOOKS_DIR)

def test_get_all(self):
response = self._get('webhooks')
Expand Down
3 changes: 1 addition & 2 deletions test/api/test_workflow_extraction.py
Expand Up @@ -5,8 +5,7 @@
from collections import namedtuple
from json import dumps, loads

from base.populators import skip_without_tool, summarize_instance_history_on_error

from galaxy_test.base.populators import skip_without_tool, summarize_instance_history_on_error
from .test_workflows import BaseWorkflowsApiTestCase


Expand Down

0 comments on commit 45019c3

Please sign in to comment.