[pegasus] Faster tokenizer tests (#7672)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user