4
4
from json import dumps as json_dumps
5
5
from json import loads as json_loads
6
6
from platform import python_implementation
7
- from typing import Any , Dict , List , NamedTuple , NewType , Tuple , Union
7
+ from typing import Any , Dict , Final , List , NamedTuple , NewType , Tuple , Union
8
8
9
9
import pytest
10
10
from attrs import define
@@ -699,7 +699,10 @@ def test_cbor2_unions(union_and_val: tuple, detailed_validation: bool):
699
699
assert converter .structure (val , type ) == val
700
700
701
701
702
- @pytest .mark .skipif (python_implementation () == "PyPy" , reason = "no msgspec on PyPy" )
702
+ NO_MSGSPEC : Final = python_implementation () == "PyPy" or sys .version_info [:2 ] >= (3 , 13 )
703
+
704
+
705
+ @pytest .mark .skipif (NO_MSGSPEC , reason = "msgspec not available" )
703
706
@given (everythings (allow_inf = False ))
704
707
def test_msgspec_json_converter (everything : Everything ):
705
708
from cattrs .preconf .msgspec import make_converter as msgspec_make_converter
@@ -709,7 +712,7 @@ def test_msgspec_json_converter(everything: Everything):
709
712
assert converter .loads (raw , Everything ) == everything
710
713
711
714
712
- @pytest .mark .skipif (python_implementation () == "PyPy" , reason = "no msgspec on PyPy " )
715
+ @pytest .mark .skipif (NO_MSGSPEC , reason = "msgspec not available " )
713
716
@given (everythings (allow_inf = False ))
714
717
def test_msgspec_json_unstruct_collection_overrides (everything : Everything ):
715
718
"""Ensure collection overrides work."""
@@ -724,7 +727,7 @@ def test_msgspec_json_unstruct_collection_overrides(everything: Everything):
724
727
assert raw ["a_frozenset" ] == sorted (raw ["a_frozenset" ])
725
728
726
729
727
- @pytest .mark .skipif (python_implementation () == "PyPy" , reason = "no msgspec on PyPy " )
730
+ @pytest .mark .skipif (NO_MSGSPEC , reason = "msgspec not available " )
728
731
@given (
729
732
union_and_val = native_unions (
730
733
include_datetimes = False ,
0 commit comments