From 9834527f2c373708252c37998b7573291fc9da63 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Wed, 19 Feb 2020 16:22:48 +0200 Subject: [PATCH] hack to switch between CLI folder setup and local setup --- spacy/tests/test_requirements.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/spacy/tests/test_requirements.py b/spacy/tests/test_requirements.py index 5bbccf362..a6fa20d6b 100644 --- a/spacy/tests/test_requirements.py +++ b/spacy/tests/test_requirements.py @@ -8,11 +8,21 @@ def test_build_dependencies(en_vocab): libs_ignore_setup = ["fugashi", "natto-py", "pythainlp"] # check requirements.txt - root_dir = Path(__file__).parent.parent - req_file = root_dir / "requirements.txt" - req_dict = {} - with req_file.open() as f: - lines = f.readlines() + try: + # for CLI usage + root_dir = Path(__file__).parent.parent + req_file = root_dir / "requirements.txt" + req_dict = {} + with req_file.open() as f: + lines = f.readlines() + except FileNotFoundError as e: + # for local usage + root_dir = Path(__file__).parent.parent.parent + req_file = root_dir / "requirements.txt" + req_dict = {} + with req_file.open() as f: + lines = f.readlines() + for line in lines: line = line.strip() if not line.startswith("#"):