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)
| 122 | |
| 123 | |
| 124 | def 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 | |
| 145 | def parse_flag_from_env(key, default=False): |
no outgoing calls
no test coverage detected