MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / get_tests_dir

Function get_tests_dir

src/diffusers/utils/testing_utils.py:124–142  ·  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

122
123
124def get_tests_dir(append_path=None):
125 """
126 Args:
127 append_path: optional path to append to the tests dir path
128 Return:
129 The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is
130 joined after the `tests` dir the former is provided.
131 """
132 # this function caller's __file__
133 caller__file__ = inspect.stack()[1][1]
134 tests_dir = os.path.abspath(os.path.dirname(caller__file__))
135
136 while not tests_dir.endswith("tests"):
137 tests_dir = os.path.dirname(tests_dir)
138
139 if append_path:
140 return Path(tests_dir, append_path).as_posix()
141 else:
142 return tests_dir
143
144
145def parse_flag_from_env(key, default=False):

Calls

no outgoing calls

Tested by

no test coverage detected