Skip to content

Commit a9da06b

Browse files
committed
Fix CI
1 parent 2f6a01a commit a9da06b

7 files changed

Lines changed: 37 additions & 35 deletions

File tree

‎tests/unit/test_common.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
Union,
3030
)
3131

32-
if sys.version_info >= (3, 15):
33-
# This is needed for `ruff` to recognize `frozendict` name
34-
# and to not raise `F821`:
35-
from builtins import frozendict
36-
3732
import pytest
3833

3934
from .utils import (
@@ -51,6 +46,11 @@
5146
import msgspec
5247
from msgspec import UNSET, Meta, Struct, UnsetType, ValidationError
5348

49+
if sys.version_info >= (3, 15):
50+
# This is needed for `ruff` to recognize `frozendict` name
51+
# and to not raise `F821`:
52+
from builtins import frozendict
53+
5454
UTC = datetime.timezone.utc
5555

5656
PY311 = sys.version_info[:2] >= (3, 11)

‎tests/unit/test_convert.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
TypeVar,
2020
)
2121

22-
if sys.version_info >= (3, 15):
23-
# This is needed for `ruff` to recognize `frozendict` name
24-
# and to not raise `F821`:
25-
from builtins import frozendict
26-
2722
import pytest
2823

2924
import msgspec
@@ -32,6 +27,7 @@
3227
from .utils import (
3328
emscripten_stack_limited,
3429
max_call_depth,
30+
py315_or_later_only,
3531
temp_module,
3632
)
3733

@@ -40,6 +36,11 @@
4036
except ImportError:
4137
attrs = None
4238

39+
if sys.version_info >= (3, 15):
40+
# This is needed for `ruff` to recognize `frozendict` name
41+
# and to not raise `F821`:
42+
from builtins import frozendict
43+
4344
PY311 = sys.version_info[:2] >= (3, 11)
4445
PY312 = sys.version_info[:2] >= (3, 12)
4546

@@ -1283,6 +1284,7 @@ class Ex(Struct):
12831284
convert(dictcls({"x": x}), Ex)
12841285

12851286

1287+
@py315_or_later_only
12861288
class TestFrozenDict:
12871289
def check_frozen(self, val, expected):
12881290
assert isinstance(expected, frozendict)

‎tests/unit/test_inspect.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
Union,
2727
)
2828

29-
if sys.version_info >= (3, 15):
30-
# This is needed for `ruff` to recognize `frozendict` name
31-
# and to not raise `F821`:
32-
from builtins import frozendict
33-
3429
import pytest
3530

3631
import msgspec
@@ -39,6 +34,11 @@
3934

4035
from .utils import py315_or_later_only, temp_module
4136

37+
if sys.version_info >= (3, 15):
38+
# This is needed for `ruff` to recognize `frozendict` name
39+
# and to not raise `F821`:
40+
from builtins import frozendict
41+
4242
PY312 = sys.version_info[:2] >= (3, 12)
4343
py312_plus = pytest.mark.skipif(not PY312, reason="3.12+ only")
4444

‎tests/unit/test_schema.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
Union,
2525
)
2626

27-
if sys.version_info >= (3, 15):
28-
# This is needed for `ruff` to recognize `frozendict` name
29-
# and to not raise `F821`:
30-
from builtins import frozendict
31-
3227
import pytest
3328

3429
import msgspec
3530
from msgspec import Meta
3631

3732
from .utils import py315_or_later_only, temp_module
3833

34+
if sys.version_info >= (3, 15):
35+
# This is needed for `ruff` to recognize `frozendict` name
36+
# and to not raise `F821`:
37+
from builtins import frozendict
38+
3939
T = TypeVar("T")
4040

4141

‎tests/unit/test_to_builtins.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
from dataclasses import dataclass, make_dataclass
1010
from typing import Any, NamedTuple
1111

12-
if sys.version_info >= (3, 15):
13-
# This is needed for `ruff` to recognize `frozendict` name
14-
# and to not raise `F821`:
15-
from builtins import frozendict
16-
1712
import pytest
1813

1914
from msgspec import UNSET, Struct, UnsetType, defstruct, to_builtins
2015

2116
from .utils import emscripten_stack_limited, py315_or_later_only
2217

18+
if sys.version_info >= (3, 15):
19+
# This is needed for `ruff` to recognize `frozendict` name
20+
# and to not raise `F821`:
21+
from builtins import frozendict
22+
2323
PY311 = sys.version_info[:2] >= (3, 11)
2424

2525
py311_plus = pytest.mark.skipif(not PY311, reason="3.11+ only")

‎tests/unit/test_toml.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
import uuid
66
from decimal import Decimal
77

8-
if sys.version_info >= (3, 15):
9-
# This is needed for `ruff` to recognize `frozendict` name
10-
# and to not raise `F821`:
11-
from builtins import frozendict
12-
138
import pytest
149

1510
import msgspec
@@ -29,6 +24,11 @@
2924

3025
from .utils import py315_or_later_only
3126

27+
if sys.version_info >= (3, 15):
28+
# This is needed for `ruff` to recognize `frozendict` name
29+
# and to not raise `F821`:
30+
from builtins import frozendict
31+
3232
needs_decode = pytest.mark.skipif(
3333
tomllib is None, reason="Neither tomllib or tomli are installed"
3434
)

‎tests/unit/test_yaml.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
import uuid
66
from decimal import Decimal
77

8-
if sys.version_info >= (3, 15):
9-
# This is needed for `ruff` to recognize `frozendict` name
10-
# and to not raise `F821`:
11-
from builtins import frozendict
12-
138
import pytest
149

1510
import msgspec
@@ -21,6 +16,11 @@
2116

2217
from .utils import py315_or_later_only
2318

19+
if sys.version_info >= (3, 15):
20+
# This is needed for `ruff` to recognize `frozendict` name
21+
# and to not raise `F821`:
22+
from builtins import frozendict
23+
2424
UTC = datetime.timezone.utc
2525

2626

0 commit comments

Comments
 (0)