-
Notifications
You must be signed in to change notification settings - Fork 84
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
Python 3 Compatibility Fixes #374
Conversation
* fixed several issues from the unit tests.
* Fixed all unit test in traits test except the TestABC...
# Conflicts: # docs/source/conf.py # traits/etsconfig/etsconfig.py # traits/tests/test_get_traits.py # traits/tests/test_traits.py # traits/trait_notifiers.py
# Conflicts: # docs/source/conf.py # traits/etsconfig/etsconfig.py # traits/tests/test_get_traits.py # traits/tests/test_traits.py # traits/trait_notifiers.py
Is |
Many thanks for this! This is very valuable, and I hope we can integrate it soon. I've taken a look through the first half of the diff, and left some comments; I'll try to find time to complete the review soon. Some general comments so far:
|
Using |
* Added `from __future__ import print_function` to all modules that had print statements * Removed `six.u` in favour of u. Python 3.2 will not be supported * Fixed a small issue with sorted in has_dynamic_views.py * Removed a trailing backslash in etsconfig.py * Removed `six.exec_` in favour of `exec` * Fixed an issue with a print statement with a trailing comma
Hi,
For the items() vs iteritems(), I went over all the cases and changed it manually wherever possible to the iteritems() variant as it is more efficient. It also has the bigger benefit of having the same behavior in both python 2 and 3. I would like to keep it in there, but I can understand that this is a functional change. Would you be open to have this maybe in a separate PR? |
* Removed all unused `import six` * Removed sm.xrange in adaptation benchmark * Replace six.iteritems mentionned in @mdickinson review
Here's the bug that appears to account for most of the test failures:
|
It looks as though the uses of It's a little odd that |
* fix trait_added property * fast_validate was not active for `File` trait * Added unit tests to ensure that the behavior is correct * Fixed an issue with `Directory` trait giving wrong error when the exist flag is set and type is wrong
I fixed the issues you mentionned. I have taken the liberty to add a few test cases to test what was not covered. In doing so, I found a bug with the Directory trait. I fixed it as well. |
I should also mention that you found all the issues of string_types. So there shouldn't be any more of these problems. |
Apologies for the long silence on this; "real" work got in the way, unfortunately. I've merged master into this branch (some conflicts, mostly trivial; the only significant conflict was in |
Codecov Report
@@ Coverage Diff @@
## master #374 +/- ##
==========================================
- Coverage 66.38% 64.16% -2.22%
==========================================
Files 48 48
Lines 7372 7373 +1
Branches 1469 1472 +3
==========================================
- Hits 4894 4731 -163
- Misses 2076 2203 +127
- Partials 402 439 +37
Continue to review full report at Codecov.
|
Merging. @jdeschenes again, apologies for taking so long to get back to this, and enormous thank you for doing this work. |
As per my issue in the [chaco issue]enthought/chaco#368)
This is a PR to completely get rid of the 2to3 using the six library
Most of the fixes are pretty mechanical and should be pretty straightforward to review:
print statement to print function
new raise syntax
relative imports
whenever I could, I converted the list iteration to an iterator
the list, dictionary in the loop and those have been explicitely converted)
LONG_TYPE instead of long
six.u instead of u''
and a lot more
The branch has been tested on python 2.7 and python 3.6.