def setup_shed_tools_for_test(app, tmpdir, testing_migrated_tools, testing_installed_tools):
 galaxy_tool_shed_test_file = os.path.join(tmpdir, 'shed_tools_dict')
 shed_tools_dict = {}
 if testing_migrated_tools:
  (has_test_data, shed_tools_dict) = parse_tool_panel_config(MIGRATED_TOOL_PANEL_CONFIG, shed_tools_dict)
 elif testing_installed_tools:
  for shed_tool_config in INSTALLED_TOOL_PANEL_CONFIGS:
   (has_test_data, shed_tools_dict) = parse_tool_panel_config(shed_tool_config, shed_tools_dict)
 with open(galaxy_tool_shed_test_file, 'w') as shed_tools_file:
  shed_tools_file.write(json.dumps(shed_tools_dict))
 if (not os.path.isabs(galaxy_tool_shed_test_file)):
  galaxy_tool_shed_test_file = os.path.join(galaxy_root, galaxy_tool_shed_test_file)
 os.environ['GALAXY_TOOL_SHED_TEST_FILE'] = galaxy_tool_shed_test_file
 if testing_installed_tools:
  tool_configs = app.config.tool_configs
  relative_migrated_tool_panel_config = os.path.join(app.config.root, MIGRATED_TOOL_PANEL_CONFIG)
  if (relative_migrated_tool_panel_config in tool_configs):
   tool_configs.remove(relative_migrated_tool_panel_config)
  for installed_tool_panel_config in INSTALLED_TOOL_PANEL_CONFIGS:
   tool_configs.append(installed_tool_panel_config)
  from galaxy import tools
  app.toolbox = tools.ToolBox(tool_configs, app.config.tool_path, app)

def setup_shed_tools_for_test ( app , tmpdir , testing_migrated_tools , testing_installed_tools ) : galaxy_tool_shed_test_file = os . path . join ( tmpdir , 'shed_tools_dict' ) shed_tools_dict = { } if testing_migrated_tools : ( has_test_data , shed_tools_dict ) = parse_tool_panel_config ( MIGRATED_TOOL_PANEL_CONFIG , shed_tools_dict ) elif testing_installed_tools : for shed_tool_config in INSTALLED_TOOL_PANEL_CONFIGS : ( has_test_data , shed_tools_dict ) = parse_tool_panel_config ( shed_tool_config , shed_tools_dict ) with open ( galaxy_tool_shed_test_file , 'w' ) as shed_tools_file : shed_tools_file . write ( json . dumps ( shed_tools_dict ) ) if ( not os . path . isabs ( galaxy_tool_shed_test_file ) ) : galaxy_tool_shed_test_file = os . path . join ( galaxy_root , galaxy_tool_shed_test_file ) os . environ [ 'GALAXY_TOOL_SHED_TEST_FILE' ] = galaxy_tool_shed_test_file if testing_installed_tools : tool_configs = app . config . tool_configs relative_migrated_tool_panel_config = os . path . join ( app . config . root , MIGRATED_TOOL_PANEL_CONFIG ) if ( relative_migrated_tool_panel_config in tool_configs ) : tool_configs . remove ( relative_migrated_tool_panel_config ) for installed_tool_panel_config in INSTALLED_TOOL_PANEL_CONFIGS : tool_configs . append ( installed_tool_panel_config ) from galaxy import tools app . toolbox = tools . ToolBox ( tool_configs , app . config . tool_path , app )
modify galaxy apps toolbox for migrated or installed tool tests .