Skip to content

Commit 74e6ba8

Browse files
authored
Move pytest options to pyproject.toml (#1279)
In addition to being the more modern approach, this lets us start to consolidate tool options into a single well-known location, and also lets us simplify the check scripts. One of the PRs that will resolve #1268.
1 parent 12d253a commit 74e6ba8

4 files changed

Lines changed: 9 additions & 31 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ We use [pytest](https://docs.pytest.org) to run our tests and
280280
[pytest-cov](https://pytest-cov.readthedocs.io) to compute coverage.
281281
282282
* While developing, periodically check that changes do not break anything. For fast checks, use
283-
`pytest -c dev_tools/conf/pytest.ini PATH`, where `PATH` is a directory or pytest file to test.
283+
`pytest -m "not slow" PATH`, where `PATH` is a directory or pytest file to test.
284284
285285
* After finishing a task, run `check/pytest` to test all of the OpenFermion code.
286286

check/pytest

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ for arg in "$@"; do
4343
done
4444

4545
if [ -z "${ACTUALLY_QUIET}" ]; then
46-
pytest -c dev_tools/conf/pytest.ini --rootdir="$rootdir" "${PYTEST_ARGS[@]}"
46+
pytest --rootdir="$rootdir" "${PYTEST_ARGS[@]}"
4747
else
4848
# Filter out lines like "...F....x... [ 42%]", with coloring.
49-
pytest -c dev_tools/conf/pytest.ini \
50-
--rootdir="$rootdir" -q --color=yes "${PYTEST_ARGS[@]}" | \
49+
pytest --rootdir="$rootdir" -q --color=yes "${PYTEST_ARGS[@]}" | \
5150
grep -Ev '^(\x1B\[0m)?[\.FEsx]+(\x1B\[36m)?[[:space:]]+\[[[:space:]]*[0-9]+%\](\x1B\[0m)?$'
5251
exit "${PIPESTATUS[0]}"
5352
fi

dev_tools/conf/pytest.ini

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

pyproject.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ skip-magic-trailing-comma = true
2323
core = "sysmon"
2424
disable_warnings = ["no-sysmon"]
2525

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/*",
26+
[tool.pytest.ini_options]
27+
markers = [
28+
"""slow: marks tests as slow (deselect with '-m "not slow"')""",
29+
]
30+
filterwarnings = [
31+
"ignore:Skipped assert_qasm_is_consistent_with_unitary because qiskit.*:UserWarning",
3232
]
3333

3434
[tool.mypy]
3535
implicit_optional = true
36-
3736
# TODO: this is temporary for 1.7.0 release. Remove this & fix the errors.
3837
ignore_errors = true
3938

0 commit comments

Comments
 (0)