Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/openfermion/chem/pubchem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

"""Tests for pubchem.py."""

import os

import numpy
import pytest
import pubchempy
import pytest

from openfermion.chem.pubchem import geometry_from_pubchem
from openfermion.testing.testing_utils import module_importable
Expand Down Expand Up @@ -74,6 +76,12 @@ def mock_get_compounds(name, searchtype, record_type='2d'):
module_importable('pubchempy') is False, reason='Not detecting `pubchempy`.'
)

# Skip if running in a CI environment.
skip_in_ci = pytest.mark.skipif(
Comment thread
mhucka marked this conversation as resolved.
Outdated
os.environ.get('CI') == 'true',
Comment thread
mhucka marked this conversation as resolved.
Outdated
reason='Skipping Pubchem API tests in CI to avoid failures due to busy servers.',
)


@using_pubchempy
class TestOpenFermionPubChem:
Expand Down Expand Up @@ -149,7 +157,8 @@ def test_water_2d(self, monkeypatch):
with pytest.raises(ValueError, match='Incorrect value for the argument structure'):
_ = geometry_from_pubchem('water', structure='foo')

@pytest.mark.flaky(retries=8, delay=30, only_on=[pubchempy.ServerBusyError])
@skip_in_ci
@pytest.mark.flaky(retries=4, delay=30, only_on=[pubchempy.ServerBusyError])
Comment thread
mhucka marked this conversation as resolved.
Outdated
def test_geometry_from_pubchem_live_api(self):
water_geometry = geometry_from_pubchem('water')
assert len(water_geometry) == 3