[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

@@ -15,7 +15,7 @@ from transformers import (
TransfoXLTokenizer,
is_torch_available,
)
from transformers.testing_utils import require_torch
from transformers.testing_utils import get_tests_dir, require_torch
from transformers.tokenization_distilbert import DistilBertTokenizerFast
from transformers.tokenization_openai import OpenAIGPTTokenizerFast
from transformers.tokenization_roberta import RobertaTokenizerFast
@@ -42,7 +42,7 @@ class CommonFastTokenizerTest(unittest.TestCase):
TOKENIZERS_CLASSES = frozenset([])
def setUp(self) -> None:
with open("tests/fixtures/sample_text.txt", encoding="utf-8") as f_data:
with open(f"{get_tests_dir()}/fixtures/sample_text.txt", encoding="utf-8") as f_data:
self._data = f_data.read().replace("\n\n", "\n").strip()
def test_all_tokenizers(self):