MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_tests_dir

Function get_tests_dir

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

133
134
135def get_tests_dir(append_path=None):
136 """
137 Args:
138 append_path: optional path to append to the tests dir path
139 Return:
140 The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is
141 joined after the `tests` dir the former is provided.
142 """
143 # this function caller's __file__
144 caller__file__ = inspect.stack()[1][1]
145 tests_dir = os.path.abspath(os.path.dirname(caller__file__))
146
147 while not tests_dir.endswith("tests"):
148 tests_dir = os.path.dirname(tests_dir)
149
150 if append_path:
151 return Path(tests_dir, append_path).as_posix()
152 else:
153 return tests_dir
154
155
156# Taken from the following PR:

Calls

no outgoing calls

Tested by

no test coverage detected