Skip to content

run fuzz in CI #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2023
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ jobs:
- name: Run tests
run: python -m tox -e flake8_5,flake8_6

slow_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox
python -m tox --notest --recreate -e flake8_6
- name: Run tests
run: python -m tox -e flake8_6 -- --onlyfuzz --no-cov -n auto

release:
runs-on: ubuntu-latest
needs: [check, test]
Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ def pytest_addoption(parser: pytest.Parser):
parser.addoption(
"--runfuzz", action="store_true", default=False, help="run fuzz tests"
)
parser.addoption(
"--onlyfuzz", action="store_true", default=False, help="only run fuzz tests"
)
parser.addoption(
"--generate-autofix",
action="store_true",
Expand All @@ -32,6 +35,13 @@ def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item
if config.getoption("--runfuzz"):
# --runfuzz given in cli: do not skip fuzz tests
return

if config.getoption("--onlyfuzz"):
for item in items.copy():
if "fuzz" not in item.keywords:
items.remove(item)
return

skip_fuzz = pytest.mark.skip(reason="need --runfuzz option to run")
for item in items:
if "fuzz" in item.keywords:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ deps =
flake8_5: flake8>=5.0,<6.0
pytest
pytest-cov
#pytest-xdist
pytest-xdist
hypothesis
hypothesmith
trio
Expand Down