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

Remove Python 2 compatibility #100

Merged
merged 1 commit into from Jan 21, 2020
Merged

Remove Python 2 compatibility #100

merged 1 commit into from Jan 21, 2020

Conversation

Djailla
Copy link

@Djailla Djailla commented Oct 15, 2019

Python 2.x will be deprecated early 2020, remove support as Django no longer support either python 2.x

@coveralls
Copy link

coveralls commented Oct 15, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 602c911 on Djailla:python3 into 6590a87 on jazzband:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 99.899% when pulling 3f16138 on Djailla:python3 into 316c340 on jazzband:master.

@Djailla
Copy link
Author

Djailla commented Oct 29, 2019

Hello @timgraham could you check my PR ?

Even if coverage decreased, this is still valid, especially with pytest requiring now python >= 3.5

@timgraham
Copy link
Contributor

Take a look at https://code.djangoproject.com/ticket/23919. There are some more cleanups that could be done like replacing force_text().

@Djailla
Copy link
Author

Djailla commented Nov 5, 2019

Hello @timgraham any idea how to fix coveralls ? Is it mandatory to validate the PR ?

@timgraham
Copy link
Contributor

It looks like you need to find the test that covers those lines on Python 2 but not on Python 3 and adjust it in some way.

@Djailla
Copy link
Author

Djailla commented Dec 2, 2019

Hello @jezdez any chance to review this PR ? Django 3.0 being official, this is blocking because Django no longer includes six

Regards

tox.ini Outdated
@@ -21,10 +20,10 @@ usedevelop = true
commands = make test
whitelist_externals = make
deps =
dj111: Django>=1.11a1,<2.0
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no need to remove a1. IMO that just makes it less obvious how to test with pre-releases in the future.

Copy link
Author

Choose a reason for hiding this comment

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

Done

@@ -80,10 +80,10 @@ def process_response(self, request, response):
# Find best match, falling back to settings.DEFAULT_HOST
try:
host, kwargs = self.get_host(request.get_host())
except DisallowedHost:
except DisallowedHost: # pragma: no cover
Copy link
Contributor

Choose a reason for hiding this comment

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

Please write a test that covers this list rather than '# pragma: no cover'.

Copy link
Author

Choose a reason for hiding this comment

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

I struggle into finding a valid test for this one in Python 3.x, could you help me on this ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I don't have time to look into it.

Copy link

Choose a reason for hiding this comment

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

@Djailla just look into tests that override the ALLOWED_HOSTS settings.
Search code for @override_settings(ALLOWED_HOSTS

Copy link

Choose a reason for hiding this comment

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

and thanks for working on it! we're waiting for this PR to merge too :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is DisallowedHost exception catching needed on Python 2 but not Python 3? That seems suspicious.

Copy link
Author

Choose a reason for hiding this comment

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

I did revert my change, the point is the exception is only raised when using Django < 2.0

Copy link
Contributor

Choose a reason for hiding this comment

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

I've removed this branch in #114.

@itsthejoker
Copy link

itsthejoker commented Dec 10, 2019

@timgraham is this and #101 good to merge?

@Djailla
Copy link
Author

Djailla commented Dec 10, 2019

@itsthejoker I'm struggling with the coverage issue.

@timgraham any idea ?

@Djailla
Copy link
Author

Djailla commented Dec 10, 2019

@itsthejoker for #101 it requires #100 to be merged first

@itsthejoker
Copy link

@Djailla I just checked and the code you reverted was what coveralls was annoyed about. There should be no decrease in coverage now, the tests just need to be re-run.

@Jdsleppy
Copy link

Jdsleppy commented Jan 5, 2020

@Djailla Pinging you to rerun the coveralls check because it should pass now. Maybe you can do it through the github.com UI, otherwise you can make a tiny commit and revert it to trigger the check again. If you don't get back to this soon, I hope you don't mind if I open a duplicate PR myself to get this fixed.

@Djailla
Copy link
Author

Djailla commented Jan 5, 2020

@Jdsleppy all green ! Thanks :)

@timgraham timgraham mentioned this pull request Jan 21, 2020
@@ -11,8 +11,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.core.signals import setting_changed
from django.urls import NoReverseMatch, reverse as reverse_path
from django.utils import six
from django.utils.encoding import iri_to_uri, force_text
from django.utils.encoding import iri_to_uri
from django.utils.functional import lazy
from django.utils.lru_cache import lru_cache
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace with from functools import lru_cache

@timgraham
Copy link
Contributor

Could you look at #114? I thought we could rebase this after merging that.

@Djailla Djailla reopened this Jan 21, 2020
@Djailla
Copy link
Author

Djailla commented Jan 21, 2020

@timgraham I though that #114 was integrating this review, but otherwise, yes no problem for a rebase 👍

@timgraham timgraham changed the title [compat] Remove python 2.x support Remove Python 2 compatibility Jan 21, 2020
@timgraham timgraham merged commit 602c911 into jazzband:master Jan 21, 2020
@Djailla Djailla deleted the python3 branch October 30, 2020 20:32
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.

None yet

6 participants