[testing] replace hardcoded paths to allow running tests from anywhere (#6523)

* [testing] replace hardcoded paths to allow running tests from anywhere

* fix the merge conflict
This commit is contained in:
Stas Bekman
2020-08-27 09:22:18 -07:00
committed by GitHub
parent 9d1b4db2aa
commit e6b811f0a7
3 changed files with 15 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
import inspect
import os
import re
import shutil
@@ -144,6 +145,15 @@ def require_torch_and_cuda(test_case):
return test_case
def get_tests_dir():
"""
returns the full path to the `tests` dir, so that the tests can be invoked from anywhere
"""
# this function caller's __file__
caller__file__ = inspect.stack()[1][1]
return os.path.abspath(os.path.dirname(caller__file__))
#
# Helper functions for dealing with testing text outputs
# The original code came from: