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)
| 85 | |
| 86 | |
| 87 | def 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 | |
| 108 | def parse_flag_from_env(key, default=False): |
nothing calls this directly
no outgoing calls
no test coverage detected