From ad9f57cbbfc50d6678059f2c32175ff3ad7ff481 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Tue, 19 Oct 2021 15:13:25 +0200 Subject: [PATCH] Allow conftest.py to run twice for build envs --- spacy/tests/conftest.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spacy/tests/conftest.py b/spacy/tests/conftest.py index 10982bac1..b88d11f0e 100644 --- a/spacy/tests/conftest.py +++ b/spacy/tests/conftest.py @@ -3,8 +3,13 @@ from spacy.util import get_lang_class def pytest_addoption(parser): - parser.addoption("--slow", action="store_true", help="include slow tests") - parser.addoption("--issue", action="store", help="test specific issues") + try: + parser.addoption("--slow", action="store_true", help="include slow tests") + parser.addoption("--issue", action="store", help="test specific issues") + # Options are already added, e.g. if conftest is copied in a build pipeline + # and runs twice + except ValueError: + pass def pytest_runtest_setup(item):