-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exclude UNPUBLISHED and add test for SSO #38
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pothiers
changed the title
do not put UNPUBLISHED in distro; add test for get_token to verify SSO
exclude UNPUBLISHED and add test for SSO
May 23, 2024
jacquesalice
requested changes
May 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pothiers I get several failures when running tests on both PAT and my DEV:
PAT:
Arranging to run doctests against: sparcl.client
Arranging to run doctests against: sparcl.gather_2d
sssssssRunning Client Tests
against Server: "sparc1.datalab.noirlab.edu"
comparing to: tests.expected_pat
showact=False
showcurl=False
client=(sparclclient:1.2.2b9, api:11.0, https://sparc1.datalab.noirlab.edu/sparc, client_hash=, verbose=False,
connect_timeout=1.1, read_timeout=5400.0)
.................Fs...s..sss.........................F....
======================================================================
FAIL: test_get_token (tests.tests_api.AuthTest)
Make sure we can get expected SSO token.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ajacques/sparclclient/tests/tests_api.py", line 858, in test_get_token
self.assertEqual(res, expected, msg="Actual to Expected")
AssertionError: <Response [200]> != '' : Actual to Expected
======================================================================
FAIL: missing_specids (sparcl.client.SparclClient)
Doctest: sparcl.client.SparclClient.missing_specids
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 2217, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for sparcl.client.SparclClient.missing_specids
File "/home/ajacques/sparclclient/sparcl/client.py", line 638, in missing_specids
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 661, in sparcl.client.SparclClient.missing_specids
Failed example:
client = SparclClient(url=_DEV)
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[0]>", line 1, in <module>
client = SparclClient(url=_DEV)
File "/home/ajacques/sparclclient/sparcl/client.py", line 210, in __init__
raise ex.ServerConnectionError(msg) from None # disable chaining
sparcl.exceptions.ServerConnectionError: [SRVCONER] Could not connect to http://localhost:8050/sparc/version/. HTTPConnectionPool(host='localhost', port=8050): Max retries exceeded with url: /sparc/version/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd1bfa76aa0>: Failed to establish a new connection: [Errno 111] Connection refused'))
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 662, in sparcl.client.SparclClient.missing_specids
Failed example:
found = client.find(outfields=['specid'], limit=2)
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[1]>", line 1, in <module>
found = client.find(outfields=['specid'], limit=2)
NameError: name 'client' is not defined
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 663, in sparcl.client.SparclClient.missing_specids
Failed example:
specids = [f.specid for f in found.records]
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[2]>", line 1, in <module>
specids = [f.specid for f in found.records]
NameError: name 'found' is not defined
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 664, in sparcl.client.SparclClient.missing_specids
Failed example:
client.missing_specids(specids + ['bad_id'])
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[3]>", line 1, in <module> client.missing_specids(specids + ['bad_id'])
My DEV:
Arranging to run doctests against: sparcl.client
Arranging to run doctests against: sparcl.gather_2d
sssssssRunning Client Tests
against Server: "sparcdev2.csdc.noirlab.edu:8050"
comparing to: tests.expected_pat
showact=False
showcurl=False
client=(sparclclient:1.2.2b9, api:11.0, http://sparcdev2.csdc.noirlab.edu:8050/sparc, client_hash=, verbose=False, connect_timeout=1.1, read_timeout=5400.0)
.................Fs...s..sss.........................F....
====================================================================== FAIL: test_get_token (tests.tests_api.AuthTest)
Make sure we can get expected SSO token.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ajacques/sparclclient/tests/tests_api.py", line 858, in test_get_token
self.assertEqual(res, expected, msg="Actual to Expected")
AssertionError: <Response [200]> != '' : Actual to Expected
======================================================================
FAIL: missing_specids (sparcl.client.SparclClient)
Doctest: sparcl.client.SparclClient.missing_specids
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 2217, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for sparcl.client.SparclClient.missing_specids
File "/home/ajacques/sparclclient/sparcl/client.py", line 638, in missing_specids
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 661, in sparcl.client.SparclClient.missing_specids
Failed example:
client = SparclClient(url=_DEV)
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[0]>", line 1, in <module>
client = SparclClient(url=_DEV)
File "/home/ajacques/sparclclient/sparcl/client.py", line 210, in __init__
raise ex.ServerConnectionError(msg) from None # disable chaining
sparcl.exceptions.ServerConnectionError: [SRVCONER] Could not connect to http://localhost:8050/sparc/version/. HTTPConnectionPool(host='localhost', port=8050): Max retries exceeded with url: /sparc/version/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7eddf7d990>: Failed to establish a new connection: [Errno 111] Connection refused'))
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 662, in sparcl.client.SparclClient.missing_specids
Failed example:
found = client.find(outfields=['specid'], limit=2)
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[1]>", line 1, in <module>
found = client.find(outfields=['specid'], limit=2)
NameError: name 'client' is not defined
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 663, in sparcl.client.SparclClient.missing_specids
Failed example:
specids = [f.specid for f in found.records]
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[2]>", line 1, in <module>
specids = [f.specid for f in found.records]
NameError: name 'found' is not defined
----------------------------------------------------------------------
File "/home/ajacques/sparclclient/sparcl/client.py", line 664, in sparcl.client.SparclClient.missing_specids
Failed example:
client.missing_specids(specids + ['bad_id'])
Exception raised:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/doctest.py", line 1346, in __run
exec(compile(example.source, filename, "single",
File "<doctest sparcl.client.SparclClient.missing_specids[3]>", line 1, in <module>
client.missing_specids(specids + ['bad_id'])
NameError: name 'client' is not defined
----------------------------------------------------------------------
Ran 65 tests in 84.146s
FAILED (failures=2, skipped=12)
test and client updated to prevent attempt to do doctests unless running against PROD server. |
Thanks @pothiers ! Works now. I'll Approve and merge |
jacquesalice
approved these changes
Jun 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Deploy to PyPi should exclude notebooks/UNPLUBLISHED/ directory so that something like
pip install sparclclient==1.2.2b9
will not install the UNBPUBLISHED directory. That dir is intended to contain notebooks we find useful but are not appropriate for general user. NOTE: the directory content will still be available via the repo so it should be ok for anyone to see it; just not useful.This also adds test_get_token. The test will fail with appropriate message output when (for instance) SSO has bad CERTS and does not work.