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

Remaining Python 3 fixes for lib/amo (except lib/git.py) #10598

Merged
merged 6 commits into from
Feb 6, 2019

Conversation

diox
Copy link
Member

@diox diox commented Feb 5, 2019

Progress towards fixing mozilla/addons#6323

@diox diox requested a review from EnTeQuAk February 5, 2019 11:02
Copy link
Contributor

@EnTeQuAk EnTeQuAk left a comment

Choose a reason for hiding this comment

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

looking good, r+ once travis agrees

@diox
Copy link
Member Author

diox commented Feb 5, 2019

Travis didn't agree (well, it was green, but that's because those tests haven't been added to the "working" section yet). I've made more fixes, another round will be necessary but they'll probably be more involved so that'll be in a different PR.

@@ -130,7 +130,7 @@ def autograph_sign_data(file_obj):
signed_manifest = six.text_type(jar.signatures)

signing_request = [{
'input': b64encode(force_bytes(signed_manifest)),
'input': force_text(b64encode(force_bytes(signed_manifest))),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just double checked, this is indeed what we want/need here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. It was broken because the contents weren't str, so that was failing to be encoded in json.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also had to do this in the other function in 1bee2d7 (locally this was working, which makes it difficult to track)

@diox diox changed the title Remaining Python 3 fixes for lib (except lib/git.py) Remaining Python 3 fixes for lib/amo (except lib/git.py) Feb 5, 2019
assert 'djDebug' not in res.content
assert 'debug_toolbar' not in res.content
assert b'djDebug' not in res.content
assert b'debug_toolbar' not in res.content
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use force_text(res.content) everywhere maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or u'djDebug' not in res.content.decode('utf-8') but we should try to find one style to do this in all our tests primarily

Copy link
Member

Choose a reason for hiding this comment

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

fwiw, we've used the b'foo' fix a lot in our other test changes (i.e. I'm not saying we shouldn't do this - and I made the same suggestion in another pr - but we're already far down the road of testing for bytestrings in raw .content)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, thinking about it, I don't think it matters much anyway. Any way works in regards to testing so 🤷‍♂️

@@ -523,8 +523,8 @@ def test_akismet_reports_created_spam_outcome_action_taken(self):

validation_response = self.get(self.url(self.guid, '3.0'))
assert validation_response.status_code == 200
assert 'spam' in validation_response.content
data = json.loads(validation_response.content)
assert b'spam' in validation_response.content
Copy link
Contributor

@EnTeQuAk EnTeQuAk Feb 6, 2019

Choose a reason for hiding this comment

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

should probably use .decode(...) or force_text too here imho. Especially if you're doing it just one line below anyway

Copy link
Contributor

@EnTeQuAk EnTeQuAk left a comment

Choose a reason for hiding this comment

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

Ignore the other comments, lgtm

@eviljeff
Copy link
Member

eviljeff commented Feb 6, 2019

merging this to make identifying the remaining broken tests easier

@eviljeff eviljeff merged commit ce8d70d into mozilla:master Feb 6, 2019
MelissaAutumn pushed a commit to thunderbird/addons-server that referenced this pull request Aug 25, 2024
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.

3 participants