mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Selenium - implement managed_history decorator for tests.
Creates and deletes a history for tests - good for tests meant to aim at production servers that need to have useful metadata and need to be cleaned up.
This commit is contained in:
@@ -60,6 +60,28 @@ except ImportError:
|
||||
return x
|
||||
|
||||
|
||||
def managed_history(f):
|
||||
"""Ensure a Selenium test has a distinct, named history.
|
||||
|
||||
Cleanup the history after the job is complete as well unless
|
||||
GALAXY_TEST_NO_CLEANUP is set in the environment.
|
||||
"""
|
||||
|
||||
@wraps(f)
|
||||
def func_wrapper(self, *args, **kwds):
|
||||
self.home()
|
||||
history_name = f.__name__ + datetime.datetime.now().strftime("%Y%m%d%H%M%s")
|
||||
self.history_panel_create_new_with_name(history_name)
|
||||
try:
|
||||
f(self, *args, **kwds)
|
||||
finally:
|
||||
if "GALAXY_TEST_NO_CLEANUP" not in os.environ:
|
||||
current_history_id = self.current_history_id()
|
||||
self.api_delete("histories/%s" % current_history_id)
|
||||
|
||||
return func_wrapper
|
||||
|
||||
|
||||
@nottest
|
||||
def selenium_test(f):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user