Skip to content

Commit

Permalink
Only run doctests when running client against PROD server
Browse files Browse the repository at this point in the history
  • Loading branch information
pothiers committed Jun 3, 2024
1 parent 58d304f commit 9dde569
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sparcl/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
15 changes: 11 additions & 4 deletions tests/tests_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 9dde569

Please sign in to comment.