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)
| 1238 | |
| 1239 | |
| 1240 | def get_tests_dir(append_path=None): |
| 1241 | """ |
| 1242 | Args: |
| 1243 | append_path: optional path to append to the tests dir path |
| 1244 | |
| 1245 | Return: |
| 1246 | The full path to the `tests` dir, so that the tests can be invoked from anywhere. Optionally `append_path` is |
| 1247 | joined after the `tests` dir the former is provided. |
| 1248 | |
| 1249 | """ |
| 1250 | # this function caller's __file__ |
| 1251 | caller__file__ = inspect.stack()[1][1] |
| 1252 | tests_dir = os.path.abspath(os.path.dirname(caller__file__)) |
| 1253 | |
| 1254 | while not tests_dir.endswith("tests"): |
| 1255 | tests_dir = os.path.dirname(tests_dir) |
| 1256 | |
| 1257 | if append_path: |
| 1258 | return os.path.join(tests_dir, append_path) |
| 1259 | else: |
| 1260 | return tests_dir |
| 1261 | |
| 1262 | |
| 1263 | # |
no outgoing calls
no test coverage detected