Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
- name: Run pytest
run: |
echo '::add-matcher::.github/problem-matchers/pytest.json'
check/pytest -n auto -m "not slow"
check/pytest -n auto --skipslow

pytest-extra:
name: Extra unit tests
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
- name: Run pytest
run: |
echo '::add-matcher::.github/problem-matchers/pytest.json'
check/pytest -n auto -m "not slow" src/openfermion/resource_estimates
check/pytest -n auto --skipslow src/openfermion/resource_estimates

pytest-compat:
name: Python compatibility tests
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
- name: Run pytest
run: |
echo '::add-matcher::.github/problem-matchers/pytest.json'
check/pytest -n auto -m "not slow"
check/pytest -n auto --skipslow

coverage:
name: Python code coverage tests
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ We use [pytest](https://docs.pytest.org) to run our tests and
in the `check/` subdirectory to run these programs.

* During development, periodically check that code changes do not break anything. For fast checks,
run `check/pytest -m "not slow" -n auto PATH ...`, where `PATH ...` is one or more directories
run `check/pytest --skipslow -n auto PATH ...`, where `PATH ...` is one or more directories
or `_test.py` files to test. (The `-n auto` option makes pytest use parallel processes; omit it
if it causes problems on your system.)

Expand Down
9 changes: 9 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ def set_threadpool_limits():
yield
else:
yield


def pytest_addoption(parser: pytest.Parser) -> None:
parser.addoption("--skipslow", action="store_true", help="skips slow tests")


def pytest_runtest_setup(item: pytest.Item) -> None:
if "slow" in item.keywords and item.config.getoption("skipslow"):
pytest.skip("skipped because of --skipslow option")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ disable_warnings = ["no-sysmon"]

[tool.pytest.ini_options]
markers = [
"""slow: marks tests as slow (deselect with '-m "not slow"')""",
"""slow: marks tests as slow (skip with '--skipslow')""",
]
filterwarnings = [
"ignore:Skipped assert_qasm_is_consistent_with_unitary because qiskit.*:UserWarning",
Expand Down
Loading