Skip to content

Commit

Permalink
Unify and simplify script driver argument processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Mar 29, 2016
1 parent fc1861c commit 915b7ed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
3 changes: 2 additions & 1 deletion run_tests.sh
Expand Up @@ -389,7 +389,8 @@ elif [ -n "$data_managers_test" ] ; then
[ -n "$test_id" ] && class=":TestForDataManagerTool_$test_id" || class=""
extra_args="functional.test_data_managers$class -data_managers"
elif [ -n "$workflow_test" ]; then
extra_args="functional.workflow:WorkflowTestCase $workflow_file"
GALAXY_TEST_WORKFLOW_FILE="$workflow_file"
extra_args="functional.workflow:WorkflowTestCase"
elif [ -n "$toolshed_script" ]; then
extra_args="$toolshed_script"
elif [ -n "$api_script" ]; then
Expand Down
35 changes: 15 additions & 20 deletions scripts/functional_tests.py
Expand Up @@ -24,17 +24,19 @@
def main():
"""Entry point for test driver script."""
# ---- Configuration ------------------------------------------------------
testing_migrated_tools = _check_arg( '-migrated' )
testing_installed_tools = _check_arg( '-installed' )
datatypes_conf_override = None
testing_migrated_tools = _check_arg('-migrated')
testing_installed_tools = _check_arg('-installed')
testing_framework_tools = _check_arg('-framework')
testing_data_manager = _check_arg('-data_managers')
testing_workflow = _check_arg('-workflow')
testing_shed_tools = testing_migrated_tools or testing_installed_tools

datatypes_conf_override = None
default_tool_conf = None
testing_shed_tools = testing_migrated_tools or testing_installed_tools
if not testing_shed_tools:
framework_test = _check_arg( '-framework' ) # Run through suite of tests testing framework.
if framework_test:
default_tool_conf = driver_util.FRAMEWORK_SAMPLE_TOOLS_CONF
datatypes_conf_override = driver_util.FRAMEWORK_DATATYPES_CONF

if testing_framework_tools:
default_tool_conf = driver_util.FRAMEWORK_SAMPLE_TOOLS_CONF
datatypes_conf_override = driver_util.FRAMEWORK_DATATYPES_CONF

start_server = 'GALAXY_TEST_EXTERNAL' not in os.environ

Expand Down Expand Up @@ -74,14 +76,11 @@ def main():
testing_migrated_tools,
testing_installed_tools,
)
workflow_test = _check_arg( '-workflow', param=True )
if workflow_test:
if testing_workflow:
import functional.workflow
functional.workflow.WorkflowTestCase.workflow_test_file = workflow_test
functional.workflow.WorkflowTestCase.master_api_key = get_master_api_key()
functional.workflow.WorkflowTestCase.user_api_key = get_user_api_key()
data_manager_test = _check_arg( '-data_managers', param=False )
if data_manager_test:
if testing_data_manager:
import functional.test_data_managers
functional.test_data_managers.data_managers = app.data_managers # seems like a hack...
functional.test_data_managers.build_tests(
Expand Down Expand Up @@ -120,15 +119,11 @@ def main():
return 1


def _check_arg( name, param=False ):
def _check_arg( name ):
try:
index = sys.argv.index( name )
del sys.argv[ index ]
if param:
ret_val = sys.argv[ index ]
del sys.argv[ index ]
else:
ret_val = True
ret_val = True
except ValueError:
ret_val = False
return ret_val
Expand Down
2 changes: 1 addition & 1 deletion test/functional/workflow.py
Expand Up @@ -17,7 +17,7 @@ class WorkflowTestCase( TwillTestCase ):
Kind of a shell of a test case for running workflow tests. Probably
needs to look more like test_toolbox.
"""
workflow_test_file = None
workflow_test_file = os.environ.get("GALAXY_TEST_WORKFLOW_FILE", None)
user_api_key = None
master_api_key = None

Expand Down

0 comments on commit 915b7ed

Please sign in to comment.