Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail with Python 3.8 #125

Closed
dbast opened this issue Nov 2, 2019 · 5 comments
Closed

Tests fail with Python 3.8 #125

dbast opened this issue Nov 2, 2019 · 5 comments

Comments

@dbast
Copy link

dbast commented Nov 2, 2019

Failure is persistent with Python 3.8 on linux/osx/win (64bit):

=================================== FAILURES ===================================
____________________________ test_intenums_as_ints _____________________________

    @pytest.mark.unit
    def test_intenums_as_ints():
        class IE(enum.IntEnum):
            val = 123
            bigval = 123123123123123123123123
    
>       assert rj.dumps([IE.val, IE.bigval]) == "[123,123123123123123123123123]"
E       AssertionError: assert '[<IE.val: 12...23123123123>]' == '[123,12312312...123123123123]'
E         - [<IE.val: 123>,<IE.bigval: 123123123123123123123123>]
E         + [123,123123123123123123123123]

tests/test_enum.py:22: AssertionError
========= 1 failed, 679 passed, 16 skipped, 2 xfailed in 2.65 seconds ==========

See also conda-forge/python-rapidjson-feedstock#21

lelit added a commit that referenced this issue Nov 2, 2019
… instances

In Python 3.8 they removed several __str__() implementations (see commit
python/cpython@96aeaec), so
under that version calling str() on an IntEnum instance gives something like
"<EnumName.attr: 123>", not the literal integer value as before, so the right thing, that
seems to work also on Python 3.7, is to use repr() instead.

This fixes issue #125.
@lelit
Copy link
Contributor

lelit commented Nov 2, 2019

This seems to fix the issue, at least for 3.7 and 3.8... let's see.

@dbast
Copy link
Author

dbast commented Nov 2, 2019

Will there be a bugfix release soon or should we cherrypick the mentioned patch?

@lelit
Copy link
Contributor

lelit commented Nov 2, 2019

I could easily make a release if you are in a hurry: I was waiting for pypa/cibuildwheel#172...

@dbast
Copy link
Author

dbast commented Nov 3, 2019

All fine. Cherry-picked aa16ff9 ... it now build+tests fine with Python 3.6, 3.7, 3.8 (on linux64, osx64, win64) :)

@lelit
Copy link
Contributor

lelit commented Nov 13, 2019

I released version 0.9.0 that includes this fix.
Thanks for the report!

@lelit lelit closed this as completed Nov 13, 2019
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

No branches or pull requests

2 participants