Skip to content

Commit

Permalink
Merge pull request #102 from adrianeboyd/feature/updates-python-312
Browse files Browse the repository at this point in the history
Updates for python 3.12
  • Loading branch information
adrianeboyd committed Sep 18, 2023
2 parents 1aa4ae1 + f80394d commit 99be682
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-rc.2"]
include:
- os: windows-2019
python_version: "3.6"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ catalogue>=2.0.3,<2.1.0
# Development requirements
cython>=0.29.1,<0.30.0
pytest>=4.6.5
pytest-timeout>=1.3.3,<2.0.0
pytest-timeout>=1.3.3
mock>=2.0.0,<3.0.0
numpy>=1.15.0
psutil
13 changes: 7 additions & 6 deletions srsly/tests/cloudpickle/cloudpickle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,13 @@ def test_module_importability(self):
pytest.importorskip("_cloudpickle_testpkg")
from srsly.cloudpickle.compat import pickle
import os.path
import distutils
import distutils.ccompiler
import collections
import collections.abc

assert _should_pickle_by_reference(pickle)
assert _should_pickle_by_reference(os.path) # fake (aliased) module
assert _should_pickle_by_reference(distutils) # package
assert _should_pickle_by_reference(distutils.ccompiler) # module in package
assert _should_pickle_by_reference(collections) # package
assert _should_pickle_by_reference(collections.abc) # module in package

dynamic_module = types.ModuleType('dynamic_module')
assert not _should_pickle_by_reference(dynamic_module)
Expand Down Expand Up @@ -874,8 +874,8 @@ def test_builtin_classicmethod(self):
or platform.python_implementation() == "PyPy"
or (sys.version_info[:2] == (3, 10) and sys.version_info >= (3, 10, 8))
# Skipping tests on 3.11 due to https://github.com/cloudpipe/cloudpickle/pull/486.
or sys.version_info[:2] == (3, 11),
reason="Fails on aarch64 + python 3.10+ in cibuildwheel, currently unable to replicate failure elsewhere; fails sometimes for pypy on conda-forge; fails for python 3.10.8+ and 3.11")
or sys.version_info[:2] >= (3, 11),
reason="Fails on aarch64 + python 3.10+ in cibuildwheel, currently unable to replicate failure elsewhere; fails sometimes for pypy on conda-forge; fails for python 3.10.8+ and 3.11+")
def test_builtin_classmethod(self):
obj = 1.5 # float object

Expand Down Expand Up @@ -1999,6 +1999,7 @@ def test_unhashable_function(self):
self.assertEqual(depickled_method('a'), 1)
self.assertEqual(depickled_method('b'), None)

@pytest.mark.skipif(sys.version_info >= (3, 12), reason="Deprecation warning in python 3.12 about future deprecation in python 3.14")
def test_itertools_count(self):
counter = itertools.count(1, step=2)

Expand Down
10 changes: 8 additions & 2 deletions srsly/tests/ruamel_yaml/test_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,10 @@ def test_issue_60(self):
)
assert data["x"]["a"] == 1
assert data["y"]["a"] == 1
assert str(data["y"]) == """ordereddict([('a', 1)])"""
if sys.version_info >= (3, 12):
assert str(data["y"]) == """ordereddict({'a': 1})"""
else:
assert str(data["y"]) == """ordereddict([('a', 1)])"""

def test_issue_60_1(self):
data = round_trip_load(
Expand All @@ -597,7 +600,10 @@ def test_issue_60_1(self):
)
assert data["x"]["a"] == 1
assert data["y"]["a"] == 1
assert str(data["y"]) == """ordereddict([('b', 2), ('a', 1)])"""
if sys.version_info >= (3, 12):
assert str(data["y"]) == """ordereddict({'b': 2, 'a': 1})"""
else:
assert str(data["y"]) == """ordereddict([('b', 2), ('a', 1)])"""


class TestEmptyLines:
Expand Down
12 changes: 9 additions & 3 deletions srsly/tests/ruamel_yaml/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


import pytest # NOQA
import sys


from .roundtrip import (
Expand Down Expand Up @@ -34,9 +35,14 @@ def test_issue_61(self):
)
data = srsly.ruamel_yaml.round_trip_load(s)
assert str(data["comb"]) == str(data["def"])
assert (
str(data["comb"]) == "ordereddict([('key', 'value'), ('key1', 'value1')])"
)
if sys.version_info >= (3, 12):
assert (
str(data["comb"]) == "ordereddict({'key': 'value', 'key1': 'value1'})"
)
else:
assert (
str(data["comb"]) == "ordereddict([('key', 'value'), ('key1', 'value1')])"
)

def test_issue_82(self, tmpdir):
program_src = r'''
Expand Down

0 comments on commit 99be682

Please sign in to comment.