Skip to content

Commit e533f2b

Browse files
authored
Merge branch 'main' into performance-optimization-list-append-15142826470891655336
2 parents e803627 + 40caf92 commit e533f2b

6 files changed

Lines changed: 61 additions & 67 deletions

File tree

check/mypy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
################################################################################
17-
# Runs mypy on the repository using a preconfigured mypy.ini file.
17+
# Runs mypy on the repository starting from the root.
1818
#
1919
# Usage:
2020
# check/mypy [--flags]
@@ -25,7 +25,7 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" || exit 1
2525
cd "$(git rev-parse --show-toplevel)" || exit 1
2626

2727
echo -e -n "\033[31m"
28-
mypy --config-file=dev_tools/conf/mypy.ini "$@" .
28+
mypy "$@" .
2929
result=$?
3030
echo -e -n "\033[0m"
3131

check/pytest-and-incremental-coverage

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ fi
7070
check/pytest . \
7171
--actually-quiet \
7272
--cov \
73-
--cov-report=annotate \
74-
--cov-config=dev_tools/conf/.coveragerc
73+
--cov-report=annotate
7574
pytest_result=$?
7675

7776
# Analyze coverage files.

dev_tools/conf/.coveragerc

Lines changed: 0 additions & 21 deletions
This file was deleted.

dev_tools/conf/mypy.ini

Lines changed: 0 additions & 39 deletions
This file was deleted.

pyproject.toml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,59 @@
1414

1515
[tool.black]
1616
line-length = 100
17-
target_version = ['py310', 'py311', 'py312', 'py313']
17+
target-version = ['py310', 'py311', 'py312', 'py313']
1818
skip-string-normalization = true
1919
skip-magic-trailing-comma = true
2020

2121
[tool.coverage.run]
2222
# Speed up pytest-cov on Python 3.12+ by enabling sys.monitoring if possible.
2323
core = "sysmon"
2424
disable_warnings = ["no-sysmon"]
25+
26+
# Omit files outside the current working directory.
27+
# Note: this means coverage must be run from the openfermion repo root.
28+
# Failure to do so will result in false positives.
29+
omit = [
30+
"./profiling/performance_benchmarks.py",
31+
"./dev_tools/*",
32+
]
33+
34+
[tool.mypy]
35+
implicit_optional = true
36+
37+
# TODO: this is temporary for 1.7.0 release. Remove this & fix the errors.
38+
ignore_errors = true
39+
40+
[[tool.mypy.overrides]]
41+
module = "__main__"
42+
follow_imports = "silent"
43+
ignore_missing_imports = true
44+
45+
[[tool.mypy.overrides]]
46+
module = [
47+
"_pytest.*",
48+
"absl",
49+
"apiclient.*",
50+
"h5py",
51+
"numpy.*",
52+
"pubchempy",
53+
"pybtas",
54+
"pyscf.*",
55+
"pytest.*",
56+
"scipy.*",
57+
"tensorflow_docs",
58+
]
59+
follow_imports = "silent"
60+
ignore_missing_imports = true
61+
62+
[[tool.mypy.overrides]]
63+
module = "sympy.*"
64+
ignore_missing_imports = true
65+
66+
[[tool.mypy.overrides]]
67+
module = "tensorflow_docs.*"
68+
ignore_missing_imports = true
69+
70+
[[tool.mypy.overrides]]
71+
module = "deprecation"
72+
follow_untyped_imports = true

src/openfermion/chem/pubchem_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
"""Tests for pubchem.py."""
1414

15+
import os
16+
1517
import numpy
16-
import pytest
1718
import pubchempy
19+
import pytest
1820

1921
from openfermion.chem.pubchem import geometry_from_pubchem
2022
from openfermion.testing.testing_utils import module_importable
@@ -149,7 +151,12 @@ def test_water_2d(self, monkeypatch):
149151
with pytest.raises(ValueError, match='Incorrect value for the argument structure'):
150152
_ = geometry_from_pubchem('water', structure='foo')
151153

152-
@pytest.mark.flaky(retries=3, delay=2, only_on=[pubchempy.ServerBusyError])
154+
# Skip if running in a CI environment.
155+
@pytest.mark.skipif(
156+
'CI' in os.environ,
157+
reason='Skipping Pubchem API tests in CI to avoid failures due to busy servers.',
158+
)
159+
@pytest.mark.flaky(retries=8, delay=30, only_on=[pubchempy.ServerBusyError])
153160
def test_geometry_from_pubchem_live_api(self):
154161
water_geometry = geometry_from_pubchem('water')
155162
assert len(water_geometry) == 3

0 commit comments

Comments
 (0)