Skip to content

Commit

Permalink
coverage only for pure py builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Sulla committed Jun 6, 2024
1 parent ed186c8 commit 5dab3d8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

Empty file removed .coveragerc_py
Empty file.
6 changes: 3 additions & 3 deletions .github/workflows/build_primary_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_SKIP: "cp311-* cp312-* pp*"
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: >
cd {package}/ &&
python -X faulthandler test/debug.py &&
python -X faulthandler -m pytest -p no:faulthandler --cov=frozendict --cov-report=term-missing --cov-branch --cov-fail-under=100
python -X faulthandler -m pytest -p no:faulthandler
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
run: pip install dist/*

- name: Test with pytest
run: pytest --cov=frozendict --cov-report=term-missing --cov-branch --cov-fail-under=100 --cov-config=.coveragerc_py
run: pytest --cov=frozendict --cov-report=term-missing --cov-branch --cov-fail-under=100

- uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_secondary_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_SKIP: "cp311-* cp312-* pp*"
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: >
cd {package}/ &&
python -X faulthandler test/debug.py &&
python -X faulthandler -m pytest -p no:faulthandler --cov=frozendict --cov-report=term-missing --cov-branch --cov-fail-under=100
python -X faulthandler -m pytest -p no:faulthandler
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -71,11 +71,11 @@ jobs:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BUILD: "cp310-*"
CIBW_SKIP: "*-musllinux_*"
CIBW_TEST_REQUIRES: pytest pytest-cov
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: >
cd {package}/ &&
python -X faulthandler test/debug.py &&
python -X faulthandler -m pytest -p no:faulthandler --cov=frozendict --cov-report=term-missing --cov-branch --cov-fail-under=100
python -X faulthandler -m pytest -p no:faulthandler
with:
package-dir: dist/frozendict.tar.gz

Expand Down
4 changes: 2 additions & 2 deletions src/frozendict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
c_ext = True
# noinspection PyUnresolvedReferences
del _frozendict
except ImportError: # pragma: no cover
except ImportError:
from ._frozendict_py import *
c_ext = False

Expand Down Expand Up @@ -50,7 +50,7 @@ def default(self, obj):

if c_ext: # pragma: no cover
__all__ = (frozendict.__name__, )
else: # pragma: no cover
else:
__all__ = _frozendict_py.__all__
del _frozendict_py

Expand Down
4 changes: 2 additions & 2 deletions src/frozendict/monkeypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def checkCExtension(*, warn, warn_c = False):

res = cool.c_ext

if warn and res == warn_c: # pragma: no cover
if warn_c:
if warn and res == warn_c:
if warn_c: # pragma: no cover
msg = "C Extension version, monkeypatch will be not applied"
else:
msg = "Pure Python version, monkeypatch will be not applied"
Expand Down
5 changes: 4 additions & 1 deletion test/test_monkeypatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import frozendict as cool
import pytest
from frozendict import frozendict
from frozendict.monkeypatch import MonkeypatchWarning


class A:
Expand All @@ -29,7 +30,9 @@ def test_get_json_encoder(
object_to_serialize_2,
serialized_object,
):
cool.monkeypatch.patchOrUnpatchJson(patch=True, warn=False)
with pytest.warns(MonkeypatchWarning):
cool.monkeypatch.patchOrUnpatchJson(patch=True, warn=True)

assert json.dumps(object_to_serialize) == serialized_object

with pytest.raises(TypeError):
Expand Down

0 comments on commit 5dab3d8

Please sign in to comment.