[pegasus] Faster tokenizer tests (#7672)

This commit is contained in:
Stas Bekman
2020-10-09 08:10:32 -07:00
committed by GitHub
parent bc00b37a0d
commit b0f05e0c4c
8 changed files with 51 additions and 29 deletions

View File

@@ -184,13 +184,23 @@ def require_faiss(test_case):
return test_case
def get_tests_dir():
def get_tests_dir(append_path=None):
"""
returns the full path to the `tests` dir, so that the tests can be invoked from anywhere
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.
"""
# this function caller's __file__
caller__file__ = inspect.stack()[1][1]
return os.path.abspath(os.path.dirname(caller__file__))
tests_dir = os.path.abspath(os.path.dirname(caller__file__))
if append_path:
return os.path.join(tests_dir, append_path)
else:
return tests_dir
#