From 3eba1f7c293ea86580bce55f84cc2a3f908d0c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 22 Jul 2024 18:05:37 +0200 Subject: [PATCH] [tests] load results from ${GDL_TEST_RESULTS} (#5262) --- test/test_extractor.py | 8 ++++++-- test/test_results.py | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/test_extractor.py b/test/test_extractor.py index 41107faa..306d2e4a 100644 --- a/test/test_extractor.py +++ b/test/test_extractor.py @@ -17,7 +17,7 @@ import string from datetime import datetime, timedelta sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from gallery_dl import extractor # noqa E402 +from gallery_dl import extractor, util # noqa E402 from gallery_dl.extractor import mastodon # noqa E402 from gallery_dl.extractor.common import Extractor, Message # noqa E402 from gallery_dl.extractor.directlink import DirectlinkExtractor # noqa E402 @@ -25,7 +25,11 @@ from gallery_dl.extractor.directlink import DirectlinkExtractor # noqa E402 _list_classes = extractor._list_classes try: - from test import results + RESULTS = os.environ.get("GDL_TEST_RESULTS") + if RESULTS: + results = util.import_file(RESULTS) + else: + from test import results except ImportError: results = None diff --git a/test/test_results.py b/test/test_results.py index 84b20917..a2e50f6a 100644 --- a/test/test_results.py +++ b/test/test_results.py @@ -20,7 +20,13 @@ import collections sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from gallery_dl import \ extractor, util, job, config, exception, formatter # noqa E402 -from test import results # noqa E402 + + +RESULTS = os.environ.get("GDL_TEST_RESULTS") +if RESULTS: + results = util.import_file(RESULTS) +else: + from test import results # temporary issues, etc.