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

RESOLVED FIXED

Status

Tree Management
Treeherder: API
P3
normal
RESOLVED FIXED
a year ago
5 months ago

People

(Reporter: emorley, Assigned: anejaalisha, Mentored)

Tracking

(Blocks: 2 bugs, {good-first-bug})

Details

(Whiteboard: [lang=py])

Attachments

(1 attachment)

(Reporter)

Description

a year ago
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
(Assignee)

Comment 1

5 months ago
Seems like I got a hack for it. This still has to be fixed, right?
(Reporter)

Comment 2

5 months ago
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
(Reporter)

Updated

5 months ago
Blocks: 1389517
(Reporter)

Comment 3

5 months ago
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@mozilla.com
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]

Comment 4

5 months ago
Created attachment 8896824 [details] [review]
[treeherder] alisha17:exception > mozilla:master
(Assignee)

Comment 5

5 months ago
I have used string of Exception instead of message, let me know if you expected some other approach!
(Reporter)

Comment 6

5 months ago
Comment on attachment 8896824 [details] [review]
[treeherder] alisha17:exception > mozilla:master

This looks great - thank you!
Attachment #8896824 - Flags: review+

Comment 7

5 months ago
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/be4a7e3d9196d352fa2311bccafe4e572de8fcd1
Bug 1326247 - Fix BaseException.message deprecation warnings (#2703)
(Reporter)

Comment 8

5 months ago
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
Last Resolved: 5 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.