-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 - pathod.app #1170
Python 3 - pathod.app #1170
Conversation
@@ -26,7 +26,7 @@ def parse_pathod(s, use_http2=False): | |||
May raise ParseException | |||
""" | |||
try: | |||
s = s.decode("ascii") | |||
s.encode("ascii") |
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.
We're only checking whether the string is valid ASCII here, so encode
would be better since it works on both Python versions. Right?
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.
👍
After making these changes, the tests in files |
Go for it! 😃 |
I'm stuck on the currently failing tests so can you please review and provide some hints as to how I can fix them? |
@dufferzafar please rebase to current master - there are a few changes there which might help debug this. Thanks. |
Looks like you need to properly encode |
312e423
to
9b8aeac
Compare
Correct me if I'm wrong, but I think the problem is in the The same types of errors also seem to be occurring in |
Yes - looks reasonable. Can you try and make the changes? If this is to complex, we might need to explore other approaches. |
@dufferzafar: Appending mitmproxy/test/pathod/test_utils.py Lines 26 to 28 in a7abf8b
|
@@ -55,12 +55,12 @@ def __len__(self): | |||
return self.length | |||
|
|||
def __getitem__(self, x): | |||
return random.choice(DATATYPES[self.dtype]) | |||
return random.choice(DATATYPES[self.dtype]).encode() |
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.
@mhils Instead of encoding values in the DATAYPES dict, we could do this, right?
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.
We could, but I think we should tackle the problem at the source and fix DATATYPES directly.
Still can't make sense of the failing tests 😭 |
So I guess the test failures happen due to the tracebacks where one of the threads just silently fails (without raising a real error, but just printing the traceback and exiting cleanly). I think this is the core problem:
|
@@ -4,7 +4,8 @@ | |||
import os | |||
import sys | |||
import threading | |||
import urllib | |||
|
|||
from six.moves.urllib.parse import unquote |
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.
@cortesi and I discussed yesterday that we do not want to import individual functions (as per https://google.github.io/styleguide/pyguide.html). Can we change this to from six.moves import urllib
?
Will have to be rebased (to remove some conflicts) once #1195 gets merged. |
@dufferzafar #1195 is merged! Great work so far - I hope we don't loose track of all those PRs you are sending 👍 |
Stalled because it depends on a lot of pathod stuff that hasn't been ported yet. |
38abd20
to
b07d32f
Compare
As per the Google Style Guide: https://google.github.io/styleguide/pyguide.html
Closing this, since #1211 will remove the |
Fixing errors that came up when trying to make the
test/pathod/test_app.py
tests pass with Py3.