-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Drop py27 and py34 support #5318
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5318 +/- ##
==========================================
+ Coverage 93.43% 94.43% +0.99%
==========================================
Files 115 115
Lines 26399 25895 -504
Branches 2606 2496 -110
==========================================
- Hits 24667 24453 -214
+ Misses 1409 1126 -283
+ Partials 323 316 -7
Continue to review full report at Codecov.
|
Oh coverage will drop quite a bit because of dead Python 2 code (which we should tackle in future PRs). |
Why not here? |
Fair enough. I will get to this tomorrow or after 4.6 gets out. 👍 |
Pushed a minor commit removing one instance/import of six - it should get removed completely (added a TODO). |
pyupgrade will handle that @blueyed -- no need to make those changes here |
@asottile |
it was my understanding from #5275 that we were going to do that in two separate branches (this one, and then I'd follow up with a separate pyupgrade branch) |
It would help / is required for the coverage - otherwise you would have to compare this "manually" from before this PR and after the pyupgrade one. |
🤷♂️ I don't think the coverage number matters too much -- I'd prefer two separate PRs personally |
About the two separate PRs: One problem with just pushing manual + automatic changes in the same PR is that it makes it difficult to review the manual changes. I'm sure if we had just pushed the changes we have here in addition to automatic changes introduced by Having said that, how about:
This might seem complicated at first sight, but is in essence just "approve it now what you see, later we will push more changes before merging". What do you guys think? |
pyupgrade is about to support this as well, mostly done :) asottile/pyupgrade#153 |
Cool! I will do it myself later anyway, a few of places are not straightforward to remove cleanly. Some examples: Lines 87 to 95 in 81cc731
Here it makes sense to use Lines 842 to 850 in 81cc731
Here it makes sense to also remove Also there are tests which are Python 2 only which should be removed completely. There other exmaples, although most would be handled by |
6969afb
to
e6f81d2
Compare
OK, removed everything I could find that was related to Python 2 in the code: code blocks with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, feel free to ignore the issue -- we can always follow up with another round of cleanup afterwards :)
I'm going to wait to pyupgrade this until we release 4.6 so we can rebase on top of that
src/_pytest/_code/code.py
Outdated
else: | ||
e = None | ||
repr_chain.reverse() | ||
return ExceptionChainRepr(repr_chain) | ||
|
||
|
||
class TerminalRepr(object): | ||
def __str__(self): | ||
s = self.__unicode__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v minor, we should be able to get rid of __unicode__
for __str__
Good catch, missed it. I will get to this later. |
Yes, I was going to suggest that. We should do that right before merging this PR, after 4.6 is out. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work. just need re-base I guess
b70f370
to
7c784b7
Compare
Rebased/squased into Also I think we can run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7c784b7
to
bdc9729
Compare
sweet, let's get this into master :D |
9cd23ab
to
e90534d
Compare
|
||
if _PY3: | ||
|
||
def safe_str(v): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i noted this one is evil, looking at usage sites made me think the removal was bad in some case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean @RonnyPfannschmidt? The Python 3 version was just calling str()
, so I changed the call sites to call str()
as well and removed the safe_str
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicoddemus the function name was terrible for indicating the actual intent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh OK.
Could you please "accept" the PR once you finished the review? It would be nice to get this into master
soon.
* Update setup.py requires and classifiers * Drop Python 2.7 and 3.4 from CI * Update docs dropping 2.7 and 3.4 support * Fix mock imports and remove tests related to pypi's mock module * Add py27 and 34 support docs to the sidebar * Remove usage of six from tmpdir * Remove six.PY* code blocks * Remove sys.version_info related code * Cleanup compat * Remove obsolete safe_str * Remove obsolete __unicode__ methods * Remove compat.PY35 and compat.PY36: not really needed anymore * Remove unused UNICODE_TYPES * Remove Jython specific code * Remove some Python 2 references from docs Related to pytest-dev#5275
e90534d
to
4d49ba6
Compare
🎉 |
Related to #5275