Refactor toward test case independence from Galaxy.

This commit is contained in:
John Chilton
2020-07-02 12:41:38 -04:00
parent 34ee279142
commit a747294bd9
4 changed files with 28 additions and 23 deletions
+24
View File
@@ -0,0 +1,24 @@
"""Base utilities for working Galaxy test environments.
"""
import os
import socket
DEFAULT_WEB_HOST = socket.gethostbyname('localhost')
def setup_keep_outdir():
keep_outdir = os.environ.get('GALAXY_TEST_SAVE', '')
if keep_outdir > '':
try:
os.makedirs(keep_outdir)
except Exception:
pass
return keep_outdir
def target_url_parts():
host = socket.gethostbyname(os.environ.get('GALAXY_TEST_HOST', DEFAULT_WEB_HOST))
port = os.environ.get('GALAXY_TEST_PORT')
default_url = "http://%s:%s" % (host, port)
url = os.environ.get('GALAXY_TEST_EXTERNAL', default_url)
return host, port, url
+1 -21
View File
@@ -41,13 +41,13 @@ 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.env import DEFAULT_WEB_HOST, target_url_parts
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 .test_logging import logging_config_file
galaxy_root = galaxy_directory()
DEFAULT_WEB_HOST = socket.gethostbyname('localhost')
DEFAULT_CONFIG_PREFIX = "GALAXY"
GALAXY_TEST_DIRECTORY = os.path.join(galaxy_root, "test")
GALAXY_TEST_FILE_DIR = "test-data,https://github.com/galaxyproject/galaxy-test-data.git"
@@ -1078,24 +1078,6 @@ def drive_test(test_driver_class):
sys.exit(test_driver.run())
def setup_keep_outdir():
keep_outdir = os.environ.get('GALAXY_TEST_SAVE', '')
if keep_outdir > '':
try:
os.makedirs(keep_outdir)
except Exception:
pass
return keep_outdir
def target_url_parts():
host = socket.gethostbyname(os.environ.get('GALAXY_TEST_HOST', DEFAULT_WEB_HOST))
port = os.environ.get('GALAXY_TEST_PORT')
default_url = "http://%s:%s" % (host, port)
url = os.environ.get('GALAXY_TEST_EXTERNAL', default_url)
return host, port, url
__all__ = (
"copy_database_template",
"build_logger",
@@ -1106,9 +1088,7 @@ __all__ = (
"database_conf",
"get_webapp_global_conf",
"nose_config_and_run",
"setup_keep_outdir",
"setup_galaxy_config",
"target_url_parts",
"TestDriver",
"wait_for_http_server",
)
+2 -1
View File
@@ -6,7 +6,8 @@ import unittest
from galaxy.security import idencoding
from galaxy.tool_util.verify.test_data import TestDataResolver
from .driver_util import GalaxyTestDriver, setup_keep_outdir, target_url_parts
from galaxy_test.base.env import setup_keep_outdir, target_url_parts
from .driver_util import GalaxyTestDriver
log = logging.getLogger(__name__)
+1 -1
View File
@@ -10,8 +10,8 @@ except ImportError:
from galaxy.tool_util.verify.interactor import GalaxyInteractorApi, verify_tool
from galaxy.tools import DataManagerTool
from galaxy_test.base.env import setup_keep_outdir, target_url_parts
from galaxy_test.base.instrument import register_job_data
from galaxy_test.driver.driver_util import setup_keep_outdir, target_url_parts
from galaxy_test.driver.testcase import FunctionalTestCase
log = logging.getLogger(__name__)