Skip to content
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

Tests fail if user is not cnnected to internet #209

Open
jhdark opened this issue May 8, 2023 · 1 comment
Open

Tests fail if user is not cnnected to internet #209

jhdark opened this issue May 8, 2023 · 1 comment

Comments

@jhdark
Copy link
Collaborator

jhdark commented May 8, 2023

When running the test suite locally without an internet connection, the test_nb_citations fails as an active connection to the crossref API is required.

Perhaps we could integrate an initial test to see if the user is online before running this test, and issue a warning that certain features will be unavailable without an active connection.

The error produced (reduced):

tests\test_materials.py .......                                                                                                                                [ 56%]
tests\test_permeability.py .....                                                                                                                               [ 60%]
tests\test_plotting.py ......                                                                                                                                  [ 64%]
tests\test_properties_group.py ......................                                                                                                          [ 81%]
tests\test_property.py ........F...                                                                                                                            [ 90%]
tests\test_solubility.py ...                                                                                                                                   [ 93%]
tests\test_system.py .........                                                                                                                                 [100%]

============================================================================= FAILURES ==============================================================================
_________________________________________________________________________ test_nb_citations _________________________________________________________________________

self = <urllib3.connection.HTTPSConnection object at 0x0000017405332440>
...
...
...
...
if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)

>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.crossref.org', port=443): Max retries exceeded with url: /works/10.1016/j.fusengdes.2015.05.060 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000017405332440>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

..\..\..\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\adapters.py:565: ConnectionError
====================================================================== short test summary info ====================================================================== 
FAILED tests/test_property.py::test_nb_citations - requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.crossref.org', port=443): Max retries exceeded with url: /works/10.1016/j.fusengdes.2015.05.06...
=================================================================== 1 failed, 130 passed in 9.48s =================================================================== 
@RemDelaporteMathurin
Copy link
Owner

Nice spot. I don't think it's priority but let's keep this open for future reference.
Maybe we could have some conditional skipping coupled to some internet connection detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants