Skip to content

Commit 1390773

Browse files
committed
Run format-incremental
1 parent ca33d4e commit 1390773

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/openfermion/chem/pubchem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_compounds_with_retries(name, record_type):
4545
except (pubchempy.PubChemHTTPError, urllib.error.URLError):
4646
if attempt == max_retries - 1:
4747
raise
48-
delay = initial_delay * (2 ** attempt)
48+
delay = initial_delay * (2**attempt)
4949
time.sleep(delay)
5050

5151
if structure in ['2d', '3d']:

src/openfermion/chem/pubchem_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,23 @@ def read(self):
172172

173173
return pubchempy.PubChemHTTPError(FakeHTTPError(503, 'Server Busy'))
174174

175+
def _get_mock_pubchem_error(self):
176+
import pubchempy
177+
178+
try:
179+
return pubchempy.PubChemHTTPError(503, 'Server Busy', ['busy'])
180+
except TypeError:
181+
182+
class FakeHTTPError(Exception):
183+
def __init__(self, code, msg):
184+
self.code = code
185+
self.reason = msg
186+
187+
def read(self):
188+
return b'{"Fault": {"Details": ["busy"]}}'
189+
190+
return pubchempy.PubChemHTTPError(FakeHTTPError(503, 'Server Busy'))
191+
175192
@patch('time.sleep', return_value=None)
176193
@patch('pubchempy.get_compounds')
177194
def test_geometry_from_pubchem_retry_success(self, mock_get_compounds, mock_sleep):

src/openfermion/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
def pytest_configure(config):
2020
# fail tests when using deprecated cirq functionality
2121
os.environ['CIRQ_TESTING'] = "true"
22+
config.addinivalue_line("markers", "integration: tests integration with other systems")
2223

2324

2425
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)