1515from planemo import galaxy_run
1616from planemo .io import warn
1717from planemo .io import shell
18+ from planemo .io import write_file
1819from planemo import git
1920
2021NO_TEST_DATA_MESSAGE = (
3940</toolbox>
4041"""
4142
43+ SHED_TOOL_CONF_TEMPLATE = """<?xml version="1.0"?>
44+ <toolbox tool_path="${shed_tools_path}">
45+ </toolbox>
46+ """
47+
48+
4249EMPTY_JOB_METRICS_TEMPLATE = """<?xml version="1.0"?>
4350<job_metrics>
4451</job_metrics>
@@ -114,8 +121,10 @@ def config_join(*args):
114121 _handle_job_metrics (config_directory , kwds )
115122 tool_definition = _tool_conf_entry_for (tool_path )
116123 empty_tool_conf = config_join ("empty_tool_conf.xml" )
124+ shed_tool_conf = config_join ("shed_tool_conf.xml" )
117125 tool_conf = config_join ("tool_conf.xml" )
118126 database_location = config_join ("galaxy.sqlite" )
127+ shed_tools_path = config_join ("shed_tools" )
119128 preseeded_database = True
120129
121130 try :
@@ -129,10 +138,13 @@ def config_join(*args):
129138 # No network access - just roll forward from null.
130139 preseeded_database = False
131140
141+ os .makedirs (shed_tools_path )
142+
132143 template_args = dict (
133144 port = kwds .get ("port" , 9090 ),
134145 host = "127.0.0.1" ,
135146 temp_directory = config_directory ,
147+ shed_tools_path = shed_tools_path ,
136148 database_location = database_location ,
137149 tool_definition = tool_definition % tool_path ,
138150 tool_conf = tool_conf ,
@@ -141,10 +153,11 @@ def config_join(*args):
141153 id_secret = kwds .get ("id_secret" , "test_secret" ),
142154 log_level = kwds .get ("log_level" , "DEBUG" ),
143155 )
156+ tool_config_file = "%s,%s" % (tool_conf , shed_tool_conf )
144157 properties = dict (
145158 file_path = "${temp_directory}/files" ,
146159 new_file_path = "${temp_directory}/tmp" ,
147- tool_config_file = tool_conf ,
160+ tool_config_file = tool_config_file ,
148161 check_migrate_tools = "False" ,
149162 manage_dependency_relationships = "False" ,
150163 job_working_directory = "${temp_directory}/job_working_directory" ,
@@ -195,10 +208,13 @@ def config_join(*args):
195208 env ["GALAXY_TEST_UPLOAD_ASYNC" ] = "false"
196209 env ["GALAXY_DEVELOPMENT_ENVIRONMENT" ] = "1"
197210 web_config = _sub (WEB_SERVER_CONFIG_TEMPLATE , template_args )
198- open (config_join ("galaxy.ini" ), "w" ). write ( web_config )
211+ write_file (config_join ("galaxy.ini" ), web_config )
199212 tool_conf_contents = _sub (TOOL_CONF_TEMPLATE , template_args )
200- open (tool_conf , "w" ).write (tool_conf_contents )
201- open (empty_tool_conf , "w" ).write (EMPTY_TOOL_CONF_TEMPLATE )
213+ write_file (tool_conf , tool_conf_contents )
214+ write_file (empty_tool_conf , EMPTY_TOOL_CONF_TEMPLATE )
215+
216+ shed_tool_conf_contents = _sub (SHED_TOOL_CONF_TEMPLATE , template_args )
217+ write_file (shed_tool_conf , shed_tool_conf_contents )
202218
203219 yield GalaxyConfig (galaxy_root , config_directory , env , test_data_dir )
204220 finally :
0 commit comments