Skip to content

Commit

Permalink
Merge pull request #210 from Fatal1ty/exclude-orjson-and-pendulum-fro…
Browse files Browse the repository at this point in the history
…m-tests-on-3.13

Skip tests with orjson and pendulum on Python 3.13
  • Loading branch information
Fatal1ty authored Apr 14, 2024
2 parents c9deb03 + 1983d40 commit ebcabc6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mashumaro/core/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"PY_310_MIN",
"PY_311_MIN",
"PY_312_MIN",
"PY_313_MIN",
"PEP_585_COMPATIBLE",
"Sentinel",
]
Expand All @@ -18,8 +19,10 @@
PY_39 = sys.version_info.major == 3 and sys.version_info.minor == 9
PY_310 = sys.version_info.major == 3 and sys.version_info.minor == 10
PY_311 = sys.version_info.major == 3 and sys.version_info.minor == 11
PY_312_MIN = sys.version_info.major == 3 and sys.version_info.minor >= 12
PY_312 = sys.version_info.major == 3 and sys.version_info.minor == 12
PY_313_MIN = sys.version_info.major == 3 and sys.version_info.minor >= 13

PY_312_MIN = PY_312 or PY_313_MIN
PY_311_MIN = PY_311 or PY_312_MIN
PY_310_MIN = PY_310 or PY_311_MIN
PY_39_MIN = PY_39 or PY_310_MIN
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgpack>=0.5.6
pyyaml>=3.13
tomli-w>=1.0
tomli>=1.1.0;python_version<'3.11'
orjson>=3.6.1
orjson>=3.6.1;python_version<'3.13'

# tests
mypy>=0.812
Expand All @@ -18,7 +18,7 @@ codespell>=2.2.2

# third party features
ciso8601>=2.1.3
pendulum>=2.1.2
pendulum>=2.1.2;python_version<'3.13'

# benchmark
pyperf>=2.6.1
Expand Down
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
from unittest.mock import patch

from mashumaro.core.const import PY_313_MIN

if PY_313_MIN:
collect_ignore = [
"test_codecs/test_orjson_codec.py",
"test_discriminated_unions/test_dialects.py",
"test_orjson.py",
"test_pep_563.py",
"test_self.py",
]

add_unpack_method = patch(
"mashumaro.core.meta.code.builder.CodeBuilder.add_unpack_method",
lambda *args, **kwargs: ...,
Expand Down
5 changes: 4 additions & 1 deletion tests/test_metadata_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

from mashumaro import DataClassDictMixin
from mashumaro.core.const import PY_312_MIN
from mashumaro.core.const import PY_312_MIN, PY_313_MIN
from mashumaro.exceptions import (
UnserializableField,
UnsupportedDeserializationEngine,
Expand Down Expand Up @@ -58,6 +58,7 @@ class DataClass(DataClassDictMixin):
assert instance == should_be


@pytest.mark.skipif(PY_313_MIN, reason="pendulum doesn't install on 3.13")
def test_pendulum_datetime_parser():
@dataclass
class DataClass(DataClassDictMixin):
Expand All @@ -68,6 +69,7 @@ class DataClass(DataClassDictMixin):
assert instance == should_be


@pytest.mark.skipif(PY_313_MIN, reason="pendulum doesn't install on 3.13")
def test_pendulum_date_parser():
@dataclass
class DataClass(DataClassDictMixin):
Expand All @@ -78,6 +80,7 @@ class DataClass(DataClassDictMixin):
assert instance == should_be


@pytest.mark.skipif(PY_313_MIN, reason="pendulum doesn't install on 3.13")
def test_pendulum_time_parser():
@dataclass
class DataClass(DataClassDictMixin):
Expand Down

0 comments on commit ebcabc6

Please sign in to comment.