[PATCH 10/11] tox: Rework warning infrastructure

Daniel Axtens dja at axtens.net
Sat Aug 25 13:09:04 AEST 2018


Hi Stephen,

So I had a look at the warnings. We see some import warnings that we saw
before, but most of them are ResourceWarnings out of xmlrpc. We can fix
all but one of them with this snippet in XMLRPCTest:

    def tearDown(self):
        # required to silence a bunch of ResourceWarnings in Py3.5 tox tests
        self.rpc._ServerProxy__transport.close()

But that seems like overkill for something that's 3.5 specific; I agree
that they should be suppressed.

OTOH,

> +    py27: PYTHONWARNINGS = once,ignore::DeprecationWarning:distutils,ignore::PendingDeprecationWarning:distutils,ignore::ImportWarning:backports
> +    py{34,35,36}:PYTHONWARNINGS = once,ignore::ResourceWarning:unittest.suite,ignore::DeprecationWarning:distutils,ignore::PendingDeprecationWarning:distutils,ignore::ImportWarning:backports

... this seems like overkill and I'm particularly concerend about the
pending depreciation warnings.

This seems to work for me:

diff --git a/tox.ini b/tox.ini
index 4eef4c447bef..3684d716657c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,12 +16,16 @@ setenv =
     DJANGO_SETTINGS_MODULE = patchwork.settings.dev
     PYTHONDONTWRITEBYTECODE = 1
     DJANGO_LIVE_TEST_SERVER_ADDRESS = localhost:9000-9200
+    py27: PYTHONWARNINGS = once
+    py{34,36}:PYTHONWARNINGS = once,ignore::ImportWarning:backports
+    py35:PYTHONWARNINGS = once,ignore::ResourceWarning:unittest.suite,ignore::ImportWarning:backports
+
 passenv =
     http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
     PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS PW_TEST_DB_HOST
     PW_TEST_DB_PORT
 commands =
-    python -Wonce {toxinidir}/manage.py test --noinput '{posargs:patchwork}'
+    python {toxinidir}/manage.py test --noinput '{posargs:patchwork}'
 
 [testenv:bashate]
 deps = bashate>=0.5,<0.6

Thoughts?

Regards,
Daniel


More information about the Patchwork mailing list