Mercurial > repos > shellac > sam_consensus_v3
diff env/lib/python3.9/site-packages/planemo/test/data.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/env/lib/python3.9/site-packages/planemo/test/data.py Mon Mar 22 18:12:50 2021 +0000 @@ -0,0 +1,37 @@ +"""Utilities related to reasoning about test data.""" + +import os + + +def find_test_data_directory(tool_paths, **kwds): + path = "." + if len(tool_paths) > 0: + path = tool_paths[0] + + # Find test data directory associated with path. + test_data = kwds.get("test_data", None) + if test_data: + return os.path.abspath(test_data) + else: + test_data = search_tool_path_for(path, "test-data") + if test_data: + return test_data + + +def search_tool_path_for(path, target, extra_paths=[]): + """Check for presence of a target in different artifact directories.""" + if not os.path.isdir(path): + tool_dir = os.path.dirname(path) + else: + tool_dir = path + possible_dirs = [tool_dir, "."] + extra_paths + for possible_dir in possible_dirs: + possible_path = os.path.join(possible_dir, target) + if os.path.exists(possible_path): + return os.path.abspath(possible_path) + return None + + +__all__ = ( + "search_tool_path_for", +)