44from json import dumps as json_dumps
55from json import loads as json_loads
66from 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
88
99import pytest
1010from attrs import define
@@ -699,7 +699,10 @@ def test_cbor2_unions(union_and_val: tuple, detailed_validation: bool):
699699 assert converter .structure (val , type ) == val
700700
701701
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" )
703706@given (everythings (allow_inf = False ))
704707def test_msgspec_json_converter (everything : Everything ):
705708 from cattrs .preconf .msgspec import make_converter as msgspec_make_converter
@@ -709,7 +712,7 @@ def test_msgspec_json_converter(everything: Everything):
709712 assert converter .loads (raw , Everything ) == everything
710713
711714
712- @pytest .mark .skipif (python_implementation () == "PyPy" , reason = "no msgspec on PyPy " )
715+ @pytest .mark .skipif (NO_MSGSPEC , reason = "msgspec not available " )
713716@given (everythings (allow_inf = False ))
714717def test_msgspec_json_unstruct_collection_overrides (everything : Everything ):
715718 """Ensure collection overrides work."""
@@ -724,7 +727,7 @@ def test_msgspec_json_unstruct_collection_overrides(everything: Everything):
724727 assert raw ["a_frozenset" ] == sorted (raw ["a_frozenset" ])
725728
726729
727- @pytest .mark .skipif (python_implementation () == "PyPy" , reason = "no msgspec on PyPy " )
730+ @pytest .mark .skipif (NO_MSGSPEC , reason = "msgspec not available " )
728731@given (
729732 union_and_val = native_unions (
730733 include_datetimes = False ,
0 commit comments