From 9dde56948f7b348ecdafd6873427b5b5ba4834b7 Mon Sep 17 00:00:00 2001 From: Steve Pothier Date: Mon, 3 Jun 2024 16:12:56 -0700 Subject: [PATCH] Only run doctests when running client against PROD server --- sparcl/client.py | 2 +- tests/tests_api.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sparcl/client.py b/sparcl/client.py index 4283e92..7abeca4 100644 --- a/sparcl/client.py +++ b/sparcl/client.py @@ -658,7 +658,7 @@ def missing_specids( are NOT stored in the SPARCL database. Example: - >>> client = SparclClient(url=_DEV) + >>> client = SparclClient() >>> found = client.find(outfields=['specid'], limit=2) >>> specids = [f.specid for f in found.records] >>> client.missing_specids(specids + ['bad_id']) diff --git a/tests/tests_api.py b/tests/tests_api.py index 29de9a5..b23b21a 100755 --- a/tests/tests_api.py +++ b/tests/tests_api.py @@ -135,11 +135,18 @@ def testcase_log_console(*args, **kwargs): def load_tests(loader, tests, ignore): import doctest - print(f"Arranging to run doctests against: sparcl.client") - tests.addTests(doctest.DocTestSuite(sparcl.client)) + if serverurl == _PROD: + print(f"Arranging to run doctests against: sparcl.client") + tests.addTests(doctest.DocTestSuite(sparcl.client)) + + print(f"Arranging to run doctests against: sparcl.gather_2d") + tests.addTests(doctest.DocTestSuite(sparcl.gather_2d)) + else: + print( + "Not running doctests since you are not running client" + " against the PRODUCTION server." + ) - print(f"Arranging to run doctests against: sparcl.gather_2d") - tests.addTests(doctest.DocTestSuite(sparcl.gather_2d)) return tests