Closed Bug 1467308 Opened 4 years ago Closed 4 years ago

Update socorro.lib folder for Python 3

Categories

(Socorro :: General, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: cmiller, Assigned: cmiller)

References

Details

Update all files in socorro.lib and their tests to run in Python 3 test runs.
Blocks: 1469718
No longer blocks: 1469718
Commits pushed to master at https://github.com/mozilla-services/socorro

https://github.com/mozilla-services/socorro/commit/d5ee30f89169b9d61dd32ba4102848659cfa8f2e
fix bug 1467308: Update socorro.lib folder for Python 3

We were dealing with a pytest that captured an expected error. When we
capture the error, there is an explicit assertion of what the error is
doing and its type. We then cast it to a string to make an assertion
about the value of the error. We then found out the behavior of
representing the class name of the error as a string changed between
python 2 and 3. Therefore to solve this we explicitly by capturing just
the value of the tested error and modified our expected error just to
include the error value expected so we could pass comparison test.
Because we already asserted the type of error, and there was a change of
behavior around representing the error type as a string. We resolved the
difference in python 2 to 3 by removing the redundant verification of
the error type.

https://github.com/mozilla-services/socorro/commit/a835c6ad52ee217ae29fa23f191214676c947116
fix bug 1467308: Update socorro.lib folder for Python 3
Resolved the implementation difference of range() function between
python 2 and 3 by converting the iterator generated in python 3 to a
list for value comparison. Then we used the six library to pivot the
change between the “queue” import between python 2 and 3. Next we were
facing errors in an implementation of converting unicode to ascii for
python 2 and conversely for python 3. We attempted to use the six lib
u() function for the conversion but due to the concise way of stripping
characters for conversion to be used by external database, this solution
didn’t work. We couldn’t find a method to explicitly do this.
(text_types may be other solution if this dent pass review.) But to fix
this problem we added an a conditional check for the version of python
that was being tested at the time.If python 2 convert string to unicode
and then return ascii value. If python 3convert it to ascii, drop
characters, and then convert it to unicode to return value.

https://github.com/mozilla-services/socorro/commit/403c5acfc078f03554f804608a05745b0b711860
fix bug 1467308 update socorro.lib

Addressed review comments. Instead of implicity stripping non ascii
characters using encode(). We explicitly only allow the range of
characters from the ascii table

https://github.com/mozilla-services/socorro/commit/87b3319d4d90e6dd853e1717b2cf93a6c567eab9
Merge pull request #4487 from ceddy-cedd/bug-1467308-Update-socorro.lib

fix bug 1467308 update socorro.lib
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Assignee: nobody → cmiller
You need to log in before you can comment on or make changes to this bug.