diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ac22d4ca..c1dcf7739 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -257,7 +257,7 @@ We use [pytest](https://docs.pytest.org) to run our tests and [pytest-cov](https://pytest-cov.readthedocs.io) to compute coverage. * While developing, periodically check that changes do not break anything. For fast checks, use - `pytest -c dev_tools/conf/pytest.ini PATH`, where `PATH` is a directory or pytest file to test. + `pytest -m "not slow" PATH`, where `PATH` is a directory or pytest file to test. * After finishing a task, run `check/pytest` to test all of the OpenFermion code. diff --git a/check/pytest b/check/pytest index 76e195780..6e48b56b3 100755 --- a/check/pytest +++ b/check/pytest @@ -43,11 +43,10 @@ for arg in "$@"; do done if [ -z "${ACTUALLY_QUIET}" ]; then - pytest -c dev_tools/conf/pytest.ini --rootdir="$rootdir" "${PYTEST_ARGS[@]}" + pytest --rootdir="$rootdir" "${PYTEST_ARGS[@]}" else # Filter out lines like "...F....x... [ 42%]", with coloring. - pytest -c dev_tools/conf/pytest.ini \ - --rootdir="$rootdir" -q --color=yes "${PYTEST_ARGS[@]}" | \ + pytest --rootdir="$rootdir" -q --color=yes "${PYTEST_ARGS[@]}" | \ grep -Ev '^(\x1B\[0m)?[\.FEsx]+(\x1B\[36m)?[[:space:]]+\[[[:space:]]*[0-9]+%\](\x1B\[0m)?$' exit "${PIPESTATUS[0]}" fi diff --git a/dev_tools/conf/pytest.ini b/dev_tools/conf/pytest.ini deleted file mode 100644 index 5f7e1fb2d..000000000 --- a/dev_tools/conf/pytest.ini +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -[pytest] -markers = - slow: marks tests as slow (deselect with '-m "not slow"') - -filterwarnings = - ignore:Skipped assert_qasm_is_consistent_with_unitary because qiskit.*:UserWarning diff --git a/pyproject.toml b/pyproject.toml index 2fba4ba31..062008954 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,9 +31,16 @@ omit = [ "./dev_tools/*", ] +[tool.pytest.ini_options] +markers = [ + """slow: marks tests as slow (deselect with '-m "not slow"')""", +] +filterwarnings = [ + "ignore:Skipped assert_qasm_is_consistent_with_unitary because qiskit.*:UserWarning", +] + [tool.mypy] implicit_optional = true - # TODO: this is temporary for 1.7.0 release. Remove this & fix the errors. ignore_errors = true