OpenFermion icon indicating copy to clipboard operation
OpenFermion copied to clipboard

Tests flaky due to dependency on network

Open viathor opened this issue 7 years ago • 4 comments

We have three tests that rely on the pubchempy module for retrieving data from the PubChem db:

  • ExamplesTest.test_can_run_examples_jupyter_notebooks,
  • OpenFermionPubChemTest.test_helium,
  • OpenFermionPubChemTest.test_water,

defined in

  • src/openfermion/tests/_examples_test.py,
  • src/openfermion/utils/_pubchem_test.py.

Since pubchempy makes outbound network connections, the tests sometimes fail for reasons unrelated to the code they are meant exercise. For example, see #480 where judging by the error code errno=99 (aka EADDRNOTAVAIL) which we got back in the URLError exception the failure appears to be due to local port number exhaustion.

Probably the best way to fix this is to use dependency injection and local datasets (retrieved from PubChem manually and stored alongside the tests).

viathor avatar Oct 18 '18 01:10 viathor

I think it is time this is revisited. The pubchem servers have been pretty flakey lately so this problem is appearing more. @viathor I can revisit this and refactor if you'd like.

ncrubin avatar Mar 07 '21 00:03 ncrubin

I propose we remove this functionality or move it to a contrib folder. pubchempy doesn't support the versions of python we are running and should not be a core dependency of OpenFermion.

https://github.com/mcs07/PubChemPy/blob/master/setup.py

ncrubin avatar Mar 07 '21 00:03 ncrubin