Closed Bug 1326247 Opened 7 years ago Closed 7 years ago

webapp/api/auth.py and seta/test_job_priorities.py: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

Categories

(Tree Management :: Treeherder: API, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: anejaalisha, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [lang=py])

Attachments

(1 file)

vagrant ~/treeherder $ PYTHONWARNINGS=once py.test tests/webapp/api/test_auth.py -k test_login_no_email --capture=no

...

[2016-12-29 18:03:22,435] WARNING [treeherder.webapp.api.auth:62] Error authenticating with Taskcluster
Traceback (most recent call last):
  File "/home/vagrant/treeherder/treeherder/webapp/api/auth.py", line 49, in login
    port=int(port))
  File "/home/vagrant/venv/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 74, in authenticate
    user = backend.authenticate(**credentials)
  File "/home/vagrant/treeherder/treeherder/auth/backends.py", line 106, in authenticate
    email = self._get_email(result)
  File "/home/vagrant/treeherder/treeherder/auth/backends.py", line 59, in _get_email
    result["clientId"], email))
TaskclusterAuthenticationFailed: Invalid email for clientId: 'foo'. Invalid value for scope 'assume:mozilla-user': 'meh'

/home/vagrant/treeherder/treeherder/webapp/api/auth.py:63: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  raise AuthenticationFailed(ex.message)

Some suggestions at:
http://stackoverflow.com/questions/1272138/baseexception-message-deprecated-in-python-2-6
http://stackoverflow.com/questions/13063212/deprecationwarning-baseexception-message-has-been-deprecated-as-of-python-2-6-e
Seems like I got a hack for it. This still has to be fixed, right?
Yeah :-)

vagrant ~/treeherder $ PYTHONWARNINGS=once py.test tests/webapp/api/test_auth.py -k test_login_no_email --capture=no
...
  /home/vagrant/treeherder/treeherder/webapp/api/auth.py:63: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
    raise AuthenticationFailed(ex.message)
Blocks: 1330474
Blocks: 1389517
Oh there's also:

tests/seta/test_job_priorities.py::test_gecko_decision_task_invalid_repo

  /home/vagrant/treeherder/tests/seta/test_job_priorities.py:34: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
    assert exception_info.value.message == "The specified project repo 'mozilla-repo-x' " \
Mentor: emorley
Keywords: good-first-bug
Summary: webapp/api/auth.py: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 → webapp/api/auth.py and seta/test_job_priorities.py: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
Whiteboard: [lang=py]
I have used string of Exception instead of message, let me know if you expected some other approach!
Comment on attachment 8896824 [details] [review]
[treeherder] alisha17:exception > mozilla:master

This looks great - thank you!
Attachment #8896824 - Flags: review+
If you're looking for some more bugs to work on, the Treeherder bugs marked as either being good first bugs, or else harder ones having a mentor show up on https://www.joshmatthews.net/bugsahoy/?reporting=1 - the ones there are mostly reasonable, though I'm going to have a clean up shortly and see if I can find some more to add to the list too.
Assignee: nobody → anejaalisha
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: