Skip to content

Commit

Permalink
fix py3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Sep 9, 2024
1 parent 38fd1f7 commit 55f942d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_20_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import datetime
from typing import Any

import pickle
import pytest

from cacholote import config, decode, encode
Expand Down Expand Up @@ -100,11 +100,18 @@ def test_filecache_default_error(raise_all_encoding_errors: bool) -> None:
class Dummy:
pass

try:
pickle.dumps(Dummy)
except Exception as exc:
match = str(exc)
else:
raise ValueError("Did not raise!")

if raise_all_encoding_errors:
with pytest.raises(AttributeError, match="Can't pickle local object"):
with pytest.raises(AttributeError, match=match):
encode.filecache_default(Dummy())
else:
with pytest.warns(UserWarning, match="Can't pickle local object"):
with pytest.warns(UserWarning, match=match):
with pytest.raises(encode.EncodeError):
encode.filecache_default(Dummy())

Expand Down

0 comments on commit 55f942d

Please sign in to comment.