MCPcopy Create free account
hub / github.com/ElementsProject/elements / find_latest_test_dir

Function find_latest_test_dir

test/functional/combine_logs.py:122–141  ·  view source on GitHub ↗

Returns the latest tmpfile test directory prefix.

()

Source from the content-addressed store, hash-verified

120
121
122def find_latest_test_dir():
123 """Returns the latest tmpfile test directory prefix."""
124 tmpdir = tempfile.gettempdir()
125
126 def join_tmp(basename):
127 return os.path.join(tmpdir, basename)
128
129 def is_valid_test_tmpdir(basename):
130 fullpath = join_tmp(basename)
131 return (
132 os.path.isdir(fullpath)
133 and basename.startswith(TMPDIR_PREFIX)
134 and os.access(fullpath, os.R_OK)
135 )
136
137 testdir_paths = [
138 join_tmp(name) for name in os.listdir(tmpdir) if is_valid_test_tmpdir(name)
139 ]
140
141 return max(testdir_paths, key=os.path.getmtime) if testdir_paths else None
142
143
144def get_log_events(source, logfile):

Callers 1

mainFunction · 0.70

Calls 2

join_tmpFunction · 0.70
is_valid_test_tmpdirFunction · 0.70

Tested by

no test coverage detected