From de6fc52721eddd4c25037f48af1d74cd3f0a8046 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 24 May 2023 12:51:03 -0400 Subject: [PATCH] When writing test error debug directories, create a latest symlink to ease navigation. --- lib/galaxy_test/selenium/framework.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/galaxy_test/selenium/framework.py b/lib/galaxy_test/selenium/framework.py index 12c5db00fa6..63fe19e997d 100644 --- a/lib/galaxy_test/selenium/framework.py +++ b/lib/galaxy_test/selenium/framework.py @@ -1,6 +1,7 @@ """Basis for Selenium test framework.""" import datetime +import errno import json import os import traceback @@ -167,6 +168,20 @@ def dump_test_information(self, name_prefix): except Exception: continue + try_symlink(target_directory, os.path.join(GALAXY_TEST_ERRORS_DIRECTORY, "latest")) + + +def try_symlink(file1, file2): + try: + try: + os.symlink(file1, file2) + except OSError as e: + if e.errno == errno.EEXIST: + os.remove(file2) + os.symlink(file1, file2) + except Exception: + pass + def selenium_test(f): test_name = f.__name__