Skip to content

Commit d4093c8

Browse files
authored
Merge pull request #173 from natefoo/shed-tools-test-history-option
Add option to `shed-tools test` for specifying a history name
2 parents 578cd95 + c922b05 commit d4093c8

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/ephemeris/shed_tools.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def test_tools(self,
230230
log=None,
231231
test_user_api_key=None,
232232
test_user="ephemeris@galaxyproject.org",
233+
test_history_name=None,
233234
parallel_tests=1,
234235
test_all_versions=False,
235236
client_test_config_path=None,
@@ -261,7 +262,16 @@ def test_tools(self,
261262
else:
262263
client_test_config = None
263264

264-
test_history = galaxy_interactor.new_history()
265+
if test_history_name:
266+
for history in self.gi.histories.get_histories(name=test_history_name, deleted=False):
267+
test_history = history['id']
268+
log.debug("Using existing history with id '%s', last updated: %s",
269+
test_history, history['update_time'])
270+
break
271+
else:
272+
test_history = galaxy_interactor.new_history(history_name=test_history_name)
273+
else:
274+
test_history = galaxy_interactor.new_history()
265275

266276
with ThreadPoolExecutor(max_workers=parallel_tests) as executor:
267277
try:
@@ -624,6 +634,7 @@ def main():
624634
log=log,
625635
test_user_api_key=args.test_user_api_key,
626636
test_user=args.test_user,
637+
test_history_name=args.test_history_name,
627638
parallel_tests=args.parallel_tests,
628639
test_all_versions=args.test_all_versions,
629640
client_test_config_path=args.client_test_config,

src/ephemeris/shed_tools_args.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ def parser():
226226
"--test_user_api_key isn't specified, this user email will be used. This "
227227
"user will be created if needed."
228228
)
229+
test_command_parser.add_argument(
230+
"--test_history_name",
231+
dest="test_history_name",
232+
default=None,
233+
help="Use existing history or create history with provided name if none exists. "
234+
"If --test_history_name is not set, a new history with a default name will always "
235+
"be created. If multiple histories match the provided name, the first (newest) "
236+
"one returned by the Galaxy API will be selected."
237+
)
229238
test_command_parser.add_argument(
230239
"--parallel_tests",
231240
dest="parallel_tests",

0 commit comments

Comments
 (0)