Skip to content

Commit

Permalink
feat[test]: add xfail_strict, clean up setup.cfg (vyperlang#3889)
Browse files Browse the repository at this point in the history
this commit adds `xfail_strict` to pytest options, and cleans up some
code relating to test and lint setup:
- move pytest coverage-enabling options to CI *only*
- suppress annoying mypy notes
- add `--dist worksteal` to setup.cfg
- pin pytest-xdist due to a regression (pytest-dev/pytest-xdist#1034)
  • Loading branch information
charles-cooper authored and electriclilies committed Apr 27, 2024
1 parent baedfb5 commit 964ca70
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yaml
Expand Up @@ -38,6 +38,7 @@ jobs:
# venom: venom changes
scopes: |
ci
build
docs
test
lang
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Expand Up @@ -136,13 +136,14 @@ jobs:
- name: Run tests
run: |
pytest \
--dist worksteal \
-m "not fuzzing" \
--optimize ${{ matrix.opt-mode }} \
--evm-version ${{ matrix.evm-version }} \
${{ matrix.debug && '--enable-compiler-debug-mode' || '' }} \
${{ matrix.memorymock && '--memorymock' || '' }} \
--showlocals -r aR \
--cov-branch \
--cov-report xml:coverage.xml \
--cov=vyper \
tests/
- name: Upload Coverage
Expand Down Expand Up @@ -192,7 +193,8 @@ jobs:
# NOTE: if the tests get poorly distributed, run this and commit the resulting `.test_durations` file to the `vyper-test-durations` repo.
# `pytest -m "fuzzing" --store-durations -r aR tests/`
- name: Fetch test-durations
run: curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/master/test_durations" -o .test_durations
run: |
curl --location "https://raw.githubusercontent.com/vyperlang/vyper-test-durations/master/test_durations" -o .test_durations
- name: Run tests
run: |
Expand All @@ -201,8 +203,10 @@ jobs:
--splits 120 \
--group ${{ matrix.group }} \
--splitting-algorithm least_duration \
--dist worksteal \
-r aR tests/
--cov-branch \
--cov-report xml:coverage.xml \
--cov=vyper \
tests/
- name: Upload Coverage
uses: codecov/codecov-action@v4
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Expand Up @@ -20,7 +20,12 @@ test:
lint: mypy black flake8 isort

mypy:
mypy --install-types --non-interactive --follow-imports=silent --ignore-missing-imports --implicit-optional -p vyper
mypy \
--disable-error-code "annotation-unchecked" \
--follow-imports=silent \
--ignore-missing-imports \
--implicit-optional \
-p vyper

black:
black -C -t py311 vyper/ tests/ setup.py --force-exclude=vyper/version.py
Expand Down
4 changes: 2 additions & 2 deletions quicktest.sh
Expand Up @@ -4,6 +4,6 @@
# ./quicktest.sh
# ./quicktest.sh tests/.../mytest.py

# run pytest but bail out on first error and suppress coverage.
# run pytest but bail out on first error
# useful for dev workflow
pytest --dist worksteal -q --no-cov -s --instafail -x --disable-warnings "$@"
pytest -q -s --instafail -x --disable-warnings "$@"
10 changes: 2 additions & 8 deletions setup.cfg
Expand Up @@ -25,15 +25,9 @@ line_length = 100

[tool:pytest]
addopts = -n auto
--cov-branch
--cov-report term
--cov-report html
--cov-report xml
--cov=vyper
--dist worksteal
python_files = test_*.py
testpaths = tests
xfail_strict = true
markers =
fuzzing: Run Hypothesis fuzz test suite (deselect with '-m "not fuzzing"')

[tool:mypy]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -11,7 +11,7 @@
"pytest>=8.0,<9.0",
"pytest-cov>=4.1,<5.0",
"pytest-instafail>=0.4,<1.0",
"pytest-xdist>=3.5,<4.0",
"pytest-xdist>=3.0,<3.4",
"pytest-split>=0.7.0,<1.0",
"eth-tester[py-evm]>=0.10.0b4,<0.11",
"eth_abi>=4.0.0,<5.0.0",
Expand Down

0 comments on commit 964ca70

Please sign in to comment.