mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Start work on synchronizing functional test drivers.
- Tweak paths in same way. - Don't write tool shed temp files to GALAXY_ROOT - respect /tmp. - Build identical loggers.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import httplib
|
||||
import logging
|
||||
import os
|
||||
import os.path
|
||||
import random
|
||||
@@ -24,6 +24,10 @@ from paste import httpserver
|
||||
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
|
||||
driver_util.configure_environment()
|
||||
log = driver_util.build_logger()
|
||||
|
||||
from base.api_util import get_master_api_key, get_user_api_key
|
||||
from base.nose_util import run
|
||||
from base.instrument import StructuredTestDataPlugin
|
||||
@@ -35,8 +39,6 @@ from galaxy.app import UniverseApplication
|
||||
from galaxy.util.properties import load_app_properties
|
||||
from galaxy.web import buildapp
|
||||
|
||||
log = logging.getLogger( "functional_tests.py" )
|
||||
|
||||
default_galaxy_test_host = "localhost"
|
||||
default_galaxy_test_port_min = 8000
|
||||
default_galaxy_test_port_max = 9999
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
"""Scripts for drivers of Galaxy functional tests."""
|
||||
|
||||
import tempfile
|
||||
import os
|
||||
import logging
|
||||
|
||||
|
||||
def setup_tool_shed_tmp_dir():
|
||||
tool_shed_test_tmp_dir = os.environ.get('TOOL_SHED_TEST_TMP_DIR', None)
|
||||
if tool_shed_test_tmp_dir is None:
|
||||
tool_shed_test_tmp_dir = tempfile.mkdtemp()
|
||||
# Here's the directory where everything happens. Temporary directories are created within this directory to contain
|
||||
# the hgweb.config file, the database, new repositories, etc. Since the tool shed browses repository contents via HTTP,
|
||||
# the full path to the temporary directroy wher eht repositories are located cannot contain invalid url characters.
|
||||
os.environ[ 'TOOL_SHED_TEST_TMP_DIR' ] = tool_shed_test_tmp_dir
|
||||
return tool_shed_test_tmp_dir
|
||||
|
||||
|
||||
def configure_environment():
|
||||
"""Hack up environment for test cases."""
|
||||
# no op remove if unused
|
||||
|
||||
|
||||
def build_logger():
|
||||
"""Build a logger for test driver script."""
|
||||
return logging.getLogger("test_driver")
|
||||
|
||||
|
||||
__all__ = [
|
||||
"configure_environment",
|
||||
"build_logger"
|
||||
]
|
||||
@@ -2,7 +2,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import httplib
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import shutil
|
||||
@@ -15,13 +14,6 @@ import time
|
||||
import urllib
|
||||
|
||||
galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))
|
||||
tool_shed_home_directory = os.path.join( galaxy_root, 'test', 'tool_shed' )
|
||||
default_tool_shed_test_file_dir = os.path.join( tool_shed_home_directory, 'test_data' )
|
||||
# Here's the directory where everything happens. Temporary directories are created within this directory to contain
|
||||
# the hgweb.config file, the database, new repositories, etc. Since the tool shed browses repository contents via HTTP,
|
||||
# the full path to the temporary directroy wher eht repositories are located cannot contain invalid url characters.
|
||||
tool_shed_test_tmp_dir = os.path.join( tool_shed_home_directory, 'tmp' )
|
||||
os.environ[ 'TOOL_SHED_TEST_TMP_DIR' ] = tool_shed_test_tmp_dir
|
||||
# Need to remove this directory from sys.path
|
||||
sys.path[0:1] = [ os.path.join( galaxy_root, "lib" ), os.path.join( galaxy_root, "test" ) ]
|
||||
|
||||
@@ -31,6 +23,11 @@ import nose.core
|
||||
import nose.loader
|
||||
import nose.plugins.manager
|
||||
|
||||
from base import driver_util
|
||||
driver_util.configure_environment()
|
||||
log = driver_util.build_logger()
|
||||
tool_shed_test_tmp_dir = driver_util.setup_tool_shed_tmp_dir()
|
||||
|
||||
# This is for the tool shed application.
|
||||
from galaxy.webapps.tool_shed import buildapp as toolshedbuildapp
|
||||
from galaxy.webapps.tool_shed.app import UniverseApplication as ToolshedUniverseApplication
|
||||
@@ -42,8 +39,6 @@ from galaxy.web import buildapp as galaxybuildapp
|
||||
from base import nose_util
|
||||
from functional import database_contexts
|
||||
|
||||
log = logging.getLogger( "tool_shed_functional_tests.py" )
|
||||
|
||||
default_tool_shed_test_host = "localhost"
|
||||
default_tool_shed_test_port_min = 8000
|
||||
default_tool_shed_test_port_max = 8999
|
||||
|
||||
Reference in New Issue
Block a user