Skip to content

Conversation

@nottmtt
Copy link

@nottmtt nottmtt commented Apr 1, 2024

This pull request adds acceptance tests for MsgPackSerializer which were lacking from the current test-suite.

They will break CI since there's currently issues when using MsgPackSerializer as the serializer, which these tests are here to catch.

See issue #834.

async def test_set_get_types(self, cache, obj):
cache.serializer = MsgPackSerializer()
assert await cache.set(Keys.KEY, obj) is True
assert await cache.get(Keys.KEY) == msgpack.loads(msgpack.dumps(obj))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some of the failures are related to the test itself (specifically msgpack.loads(msgpack.dumps(obj)))?
https://github.com/aio-libs/aiocache/actions/runs/8513779973/job/23320587633?pr=836#step:7:82

Copy link
Author

@nottmtt nottmtt Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the test itself is causing issues here; adding

assert msgpack.loads(msgpack.dumps(obj)) == obj

right before the other asserts in TestMsgPackSerializer doesn't raise any error.

My guess would be that TypeError: a bytes-like object is required, not 'str' is raised because of the same encoding issues as the UnicodeDecodeError ones. But it's not raised by msgpack itself, that's for sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess would be that TypeError: a bytes-like object is required, not 'str' is raised because of the same encoding issues as the UnicodeDecodeError ones. But it's not raised by msgpack itself, that's for sure.

That's the one I was linking to. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants