MCPcopy Create free account
hub / github.com/AlayaLab/Hive / get_tests_dir

Function get_tests_dir

models/flowsep/diffusers/utils/testing_utils.py:87–105  ·  view source on GitHub ↗

Args: append_path: optional path to append to the tests dir path Return: The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is joined after the `tests` dir the former is provided.

(append_path=None)

Source from the content-addressed store, hash-verified

85
86
87def get_tests_dir(append_path=None):
88 """
89 Args:
90 append_path: optional path to append to the tests dir path
91 Return:
92 The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is
93 joined after the `tests` dir the former is provided.
94 """
95 # this function caller's __file__
96 caller__file__ = inspect.stack()[1][1]
97 tests_dir = os.path.abspath(os.path.dirname(caller__file__))
98
99 while not tests_dir.endswith("tests"):
100 tests_dir = os.path.dirname(tests_dir)
101
102 if append_path:
103 return os.path.join(tests_dir, append_path)
104 else:
105 return tests_dir
106
107
108def parse_flag_from_env(key, default=False):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected