Skip to content

Commit

Permalink
Run slow tests without coverage
Browse files Browse the repository at this point in the history
Per suggestion from @alexmojaki at
#129 (comment)

These slower tests are integration/kitchen-sink tests, so they
shouldn't add substantially to the code coverage. Running them
without coverage is quite a lot faster (several minutes in CI)
which is well worth the small additional complexity.

This commit also drops pytest outputting the junit xml file
as there's not an obvious way to combine that from multiple
test runs and it appears to be unused.
  • Loading branch information
PeterJCLaw committed Oct 26, 2023
1 parent 3302687 commit 7ca590b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ jobs:

- name: Test with pytest
run: |
pytest --cov -n auto --junitxml=./rspec.xml
pytest --cov -n auto -m "not slow"
coverage report -m
pytest -n auto -m slow
- name: Collect coverage results
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ universal=1


[tool:pytest]
addopts = --disable-warnings --ignore=tests/testdata
addopts = --disable-warnings --ignore=tests/testdata --strict-markers
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
2 changes: 2 additions & 0 deletions tests/test_mark_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import inspect
import io
import os
import pytest
import re
import sys
import textwrap
Expand Down Expand Up @@ -630,6 +631,7 @@ def test_complex_slice_and_parens(self):
self.create_mark_checker(source)

if six.PY3:
@pytest.mark.slow
def test_sys_modules(self):
"""
Verify all nodes on source files obtained from sys.modules.
Expand Down

0 comments on commit 7ca590b

Please sign in to comment.