def run_in_config(ctx, config, run=run_galaxy_command, test_data_target_dir=None, **kwds): """Run Galaxy tests with the run_tests.sh command. The specified `config` object describes the context for tool execution. """ config_directory = config.config_directory html_report_file = kwds["test_output"] job_output_files = kwds.get("job_output_files", None) if job_output_files is None: job_output_files = os.path.join(config_directory, "jobfiles") xunit_report_file = _xunit_state(kwds, config) xunit_report_file_tracker = _FileChangeTracker(xunit_report_file) structured_report_file = _structured_report_file(kwds, config) structured_report_file_tracker = _FileChangeTracker(structured_report_file) info("Testing using galaxy_root %s", config.galaxy_root) # TODO: Allow running dockerized Galaxy here instead. server_ini = os.path.join(config_directory, "galaxy.ini") config.env["GALAXY_CONFIG_FILE"] = server_ini config.env["GALAXY_TEST_VERBOSE_ERRORS"] = "true" config.env["GALAXY_TEST_SAVE"] = job_output_files cd_to_galaxy_command = ['cd', config.galaxy_root] test_cmd = test_structures.GalaxyTestCommand( html_report_file, xunit_report_file, structured_report_file, failed=kwds.get("failed", False), installed=kwds.get("installed", False), ).build() setup_common_startup_args = "" if kwds.get("skip_venv", False): setup_common_startup_args = shell_join( 'COMMON_STARTUP_ARGS=--skip-venv', 'export COMMON_STARTUP_ARGS', 'echo "Set COMMON_STARTUP_ARGS to ${COMMON_STARTUP_ARGS}"', ) setup_venv_command = setup_venv(ctx, kwds) cmd = shell_join( cd_to_galaxy_command, setup_common_startup_args, setup_venv_command, test_cmd, ) action = "Testing tools" return_code = run(ctx, cmd, config.env, action) if kwds.get('update_test_data', False): copy_tree(job_output_files, test_data_target_dir or config.test_data_dir) _check_test_outputs(xunit_report_file_tracker, structured_report_file_tracker) test_results = test_structures.GalaxyTestResults( structured_report_file, xunit_report_file, html_report_file, return_code, ) structured_data = test_results.structured_data return handle_reports_and_summary(ctx, structured_data, exit_code=test_results.exit_code, kwds=kwds)
def run_in_config(ctx, config, **kwds): config_directory = config.config_directory html_report_file = kwds["test_output"] job_output_files = kwds.get("job_output_files", None) if job_output_files is None: job_output_files = os.path.join(config_directory, "jobfiles") xunit_supported, xunit_report_file = __xunit_state(kwds, config) structured_report_file = __structured_report_file(kwds, config) info("Testing using galaxy_root %s", config.galaxy_root) # TODO: Allow running dockerized Galaxy here instead. server_ini = os.path.join(config_directory, "galaxy.ini") config.env["GALAXY_CONFIG_FILE"] = server_ini config.env["GALAXY_TEST_VERBOSE_ERRORS"] = "true" config.env["GALAXY_TEST_SAVE"] = job_output_files cd_to_galaxy_command = "cd %s" % config.galaxy_root test_cmd = test_structures.GalaxyTestCommand( html_report_file, xunit_report_file, structured_report_file, failed=kwds.get("failed", False), installed=kwds.get("installed", False), ).build() setup_common_startup_args = "" if kwds.get("skip_venv", False): setup_common_startup_args = ( 'COMMON_STARTUP_ARGS=--skip-venv; ' 'export COMMON_STARTUP_ARGS; ' 'echo "Set COMMON_STARTUP_ARGS to ${COMMON_STARTUP_ARGS}"') setup_venv_command = setup_venv(ctx, kwds) cmd = shell_join( cd_to_galaxy_command, setup_common_startup_args, setup_venv_command, test_cmd, ) action = "Testing tools" return_code = run_galaxy_command(ctx, cmd, config.env, action) if kwds.get('update_test_data', False): update_cp_args = (job_output_files, config.test_data_dir) shell('cp -r "%s"/* "%s"' % update_cp_args) if xunit_report_file and (not os.path.exists(xunit_report_file)): warn(NO_XUNIT_MESSAGE) xunit_report_file = None test_results = test_structures.GalaxyTestResults( structured_report_file, xunit_report_file, html_report_file, return_code, ) test_data = test_results.structured_data handle_reports(ctx, test_data, kwds) __handle_summary(test_results, **kwds) return return_code
def run_in_config(ctx, config, run=run_galaxy_command, **kwds): """Run Galaxy tests with the run_tests.sh command. The specified `config` object describes the context for tool execution. """ config_directory = config.config_directory html_report_file = kwds["test_output"] job_output_files = kwds.get("job_output_files", None) if job_output_files is None: job_output_files = os.path.join(config_directory, "jobfiles") xunit_report_file = _xunit_state(kwds, config) xunit_report_file_tracker = _FileChangeTracker(xunit_report_file) structured_report_file = _structured_report_file(kwds, config) structured_report_file_tracker = _FileChangeTracker(structured_report_file) info("Testing using galaxy_root %s", config.galaxy_root) # TODO: Allow running dockerized Galaxy here instead. server_ini = os.path.join(config_directory, "galaxy.ini") config.env["GALAXY_CONFIG_FILE"] = server_ini config.env["GALAXY_TEST_VERBOSE_ERRORS"] = "true" config.env["GALAXY_TEST_SAVE"] = job_output_files cd_to_galaxy_command = "cd %s" % config.galaxy_root test_cmd = test_structures.GalaxyTestCommand( html_report_file, xunit_report_file, structured_report_file, failed=kwds.get("failed", False), installed=kwds.get("installed", False), ).build() setup_common_startup_args = "" if kwds.get("skip_venv", False): setup_common_startup_args = ( 'COMMON_STARTUP_ARGS=--skip-venv; ' 'export COMMON_STARTUP_ARGS; ' 'echo "Set COMMON_STARTUP_ARGS to ${COMMON_STARTUP_ARGS}"' ) setup_venv_command = setup_venv(ctx, kwds) cmd = shell_join( cd_to_galaxy_command, setup_common_startup_args, setup_venv_command, test_cmd, ) action = "Testing tools" return_code = run( ctx, cmd, config.env, action ) if kwds.get('update_test_data', False): update_cp_args = (job_output_files, config.test_data_dir) shell('cp -r "%s"/* "%s"' % update_cp_args) _check_test_outputs(xunit_report_file_tracker, structured_report_file_tracker) test_results = test_structures.GalaxyTestResults( structured_report_file, xunit_report_file, html_report_file, return_code, ) structured_data = test_results.structured_data return handle_reports_and_summary( ctx, structured_data, exit_code=test_results.exit_code, kwds=kwds )
def run_in_config(ctx, config, **kwds): config_directory = config.config_directory html_report_file = kwds["test_output"] job_output_files = kwds.get("job_output_files", None) if job_output_files is None: job_output_files = os.path.join(config_directory, "jobfiles") xunit_supported, xunit_report_file = __xunit_state(kwds, config) structured_report_file = __structured_report_file(kwds, config) info("Testing using galaxy_root %s", config.galaxy_root) # TODO: Allow running dockerized Galaxy here instead. server_ini = os.path.join(config_directory, "galaxy.ini") config.env["GALAXY_CONFIG_FILE"] = server_ini config.env["GALAXY_TEST_VERBOSE_ERRORS"] = "true" config.env["GALAXY_TEST_SAVE"] = job_output_files cd_to_galaxy_command = "cd %s" % config.galaxy_root test_cmd = test_structures.GalaxyTestCommand( html_report_file, xunit_report_file, structured_report_file, failed=kwds.get("failed", False), installed=kwds.get("installed", False), ).build() setup_common_startup_args = "" if kwds.get("skip_venv", False): setup_common_startup_args = ( 'COMMON_STARTUP_ARGS=--skip-venv; ' 'export COMMON_STARTUP_ARGS; ' 'echo "Set COMMON_STARTUP_ARGS to ${COMMON_STARTUP_ARGS}"' ) setup_venv_command = setup_venv(ctx, kwds) cmd = shell_join( cd_to_galaxy_command, setup_common_startup_args, setup_venv_command, test_cmd, ) action = "Testing tools" return_code = run_galaxy_command( ctx, cmd, config.env, action ) if kwds.get('update_test_data', False): update_cp_args = (job_output_files, config.test_data_dir) shell('cp -r "%s"/* "%s"' % update_cp_args) if xunit_report_file and (not os.path.exists(xunit_report_file)): warn(NO_XUNIT_MESSAGE) xunit_report_file = None test_results = test_structures.GalaxyTestResults( structured_report_file, xunit_report_file, html_report_file, return_code, ) test_data = test_results.structured_data handle_reports(ctx, test_data, kwds) __handle_summary( test_results, **kwds ) return return_code