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

bug_1447315 - Fix warnings #798

Merged
merged 10 commits into from
Nov 12, 2018

Conversation

allan-silva
Copy link
Contributor

@allan-silva allan-silva commented Sep 13, 2018

tox.ini Outdated
@@ -15,7 +15,7 @@ commands=
basepython=python2.7
deps = -rrequirements-test.txt
commands=
py.test -n2 --cov=auslib --doctest-modules {posargs:auslib}
py.test -W default::DeprecationWarning -W default::PendingDeprecationWarning -n2 --cov=auslib --doctest-modules {posargs:auslib}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you adjust agent/ and client/ for this, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

auslib/test/admin/views/test_releases.py Show resolved Hide resolved
@allan-silva
Copy link
Contributor Author

@mozbhearsum, in my first commit I completely forgot py3 task, the warnings were fixed for our code, but a bunch of warnings that come from sqlalchemy-migrate and other packages still printed in the warning summary:

https://tools.taskcluster.net/groups/DZ8mS1Z6RRG2k7n8O8vkXQ/tasks/GXdavCVURAunRZJ_KQ5fQQ/runs/0/logs/public%2Flogs%2Flive.log#L3291

I do not touched in client test config, once it does not use py.test, also, I do not found an explicity option to enable deprecation warnings in nosetests. Let me know if you want to change test suite of cliente to py.test.

@nthomas-mozilla
Copy link
Contributor

I'll take over the review here. Planning to take a look first thing next week.

@nthomas-mozilla
Copy link
Contributor

The balrog changes all look good to me, there's just the py36 warnings from the deps to suppress if we can. It's somewhat confusing that py27 does not have this behaviour so it might have been a change in py36 itself. Probably we need to set up filterwarnings in the tox.ini to fix this up.

Of note is that pytest 3.8 has a changelog entry
#2908: DeprecationWarning and PendingDeprecationWarning are now shown by default if no other warning filter is configured. This makes pytest more compliant with PEP-0506. See the docs for more info.
so the tox.ini changes may no longer be necessary. Configuring filterwarnings replaces that, I think, based on this pytest issue. A fix for that has landed for 3.9 but currently unshipped. Perhaps there's a config that'll work both now and after that ships, which suppresses DeprecationWarning and PendingDeprecationWarning in general, but not for Balrog code.

@nthomas-mozilla
Copy link
Contributor

nthomas-mozilla commented Oct 9, 2018

FYI, we just updated pytest from 3.7.3 to 3.8.2 today.

Edit - nope! It was a little while ago. Anyway, definitely worth merging from master.

@allan-silva allan-silva force-pushed the fix-warnings branch 3 times, most recently from 9becfed to d576690 Compare October 13, 2018 06:04
@allan-silva
Copy link
Contributor Author

@nthomas-mozilla,
Until the next release of pytest, we need set filter for DeprecationWarning and PendingDeprecationWarning (https://github.com/pytest-dev/pytest/blob/features/changelog/4013.feature.rst).

The only way I found to hide warnings from other libs is using the regex filter:
ignore:.*inspect.getargspec.* is deprecated.*.

Here the test log, in which I forced a warning in balrog code:
py27 - https://tools.taskcluster.net/groups/bYoNawiNQD28zGpCgfGXXw/tasks/bYoNawiNQD28zGpCgfGXXw/runs/0/logs/public%2Flogs%2Flive.log

py36 - https://tools.taskcluster.net/groups/bYoNawiNQD28zGpCgfGXXw/tasks/QppSMfIrQFCeoabCw7WWpw/runs/0/logs/public%2Flogs%2Flive.log

tox.ini Outdated
default::DeprecationWarning
default::PendingDeprecationWarning
ignore:.*inspect.getargspec.* is deprecated.*
ignore:invalid escape sequence.*
Copy link
Contributor

Choose a reason for hiding this comment

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

@allan-silva sorry for the delay in getting back to this. We've taken the pytest 3.9 upgrade via pyup so it would be good to rerun the tests and make sure the filters are still set correctly.

I also wondered if this approach might be helpful in ./tox.ini:

filterwarnings =
    ignore
    error:::auslib
    default::DeprecationWarning:auslib
    default::PendingDeprecationWarning:auslib

The idea is to ignore all warnings in deps, while in auslib warn about deprecations, and upgrade to error anything else. It would avoid suppressing the named errors in Balrog code, I think.

The other tox.ini would need equivalent changes too ?

@allan-silva
Copy link
Contributor Author

@nthomas-mozilla I updated the tox files to use filterWarnings as you suggested, actually, I had no much known the filterWarnings match rules.
It was necessary include ignore::ImportWarning:auslib.db, once the sql-alchemy-migrate module conflicts with auslib/migrate folder (other option is rename the folder). Also, your work on #833 is already applied here.

Copy link
Contributor

@nthomas-mozilla nthomas-mozilla left a comment

Choose a reason for hiding this comment

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

self.assertEqual('this pull request', 'extremely awesome').

So fantastic to have tidy test logs again.

@nthomas-mozilla nthomas-mozilla merged commit 1ed210d into mozilla-releng:master Nov 12, 2018
@allan-silva allan-silva deleted the fix-warnings branch November 13, 2018 10:26
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