-
Notifications
You must be signed in to change notification settings - Fork 20
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
Python3 etc #31
Merged
Merged
Python3 etc #31
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This error is too much of a squeaky wheel in this module.
No need to catch the exception and raise a more helpful error; simply annotate the test instead.
See python3porting.com :)
Replace with a helper (2to3 is too expensive!)
The test which sets up an enum with integers and tuples as values fails here in this deprecated block because the values don't compare. Just skip that if it happens; it's probably a silly case anyway.
Use the 'six' with_metaclass helper. The exception must handle a new type of virtual base class; make it generic while we're here. ie, a 'RichEnum' sub-class can define __virtual__ to suppress this exception.
The total_ordering wrapper is a no-op on python 3.
This was sporadic on Python 3 and a deprecated field, so just make sure all fields are present.
Changelog, add trove classifiers to setup.py, and complete the tox.ini
E: 3, 0: No name 'total_ordering' in module 'functools' (no-name-in-module) Ah, well. I'm not sure the workarounds are worth it. Patches from 2.6-folk welcome.
'unicode' does not exist in python 3, and flake8 doesn't know that these branches aren't reachable.
Pypy returns the following strange encoding error sometimes: ====================================================================== FAIL: test_unicode_handling (tests.richenum.test_ordered_rich_enums.OrderedRichEnumTestSuite) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/samv/projects/richenum/tests/richenum/test_ordered_rich_enums.py", line 120, in test_unicode_handling r"<BreakfastEnumValue hearsaycorp#3: oatmeal. \('Oatmeal.'\)>", AssertionError: Regexp didn't match: "<BreakfastEnumValue hearsaycorp#3: oatmeal. \\('Oatmeal.'\\)>" not found in "<BreakfastEnumValue hearsaycorp#3: oatmeal?? ('Oatmeal??')>" ====================================================================== FAIL: test_unicode_handling (tests.richenum.test_rich_enums.RichEnumTestSuite) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/samv/projects/richenum/tests/richenum/test_rich_enums.py", line 145, in test_unicode_handling "<VegetableEnumValue: okra. \('Okra.'\)>", AssertionError: Regexp didn't match: "<VegetableEnumValue: okra. \\('Okra.'\\)>" not found in "<VegetableEnumValue: okra?? ('Okra??')>" ---------------------------------------------------------------------- Ran 34 tests in 0.047s FAILED (failures=2) Somehow this multi-byte character is getting converted to two ??'s. It happens occasionally locally, but not repeatably. It doesn't matter hugely, as it is mostly costmetic: let it stand.
@samv These changes look fine to me, but we'll need to bump the version number. |
Sure, I'm down with that. Also, now that Python 3.4 ships with an enum module, it would be good to review and document how this module's API is different, and whether it can be made usefully compatible. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As an exercise after the python 2 to 3 talk at PyCon (go watch http://pyvideo.org/video/2626/by-your-bootstraps-porting-your-application-to-p ), I thought I'd work on portability for this simple module.
/review @akshayjshah @dhui @rbm