diff mbox series

[10/11] tox: Rework warning infrastructure

Message ID 20180624195557.19909-10-stephen@that.guru
State Accepted
Headers show
Series [01/11] REST: Check.user is not read-only | expand

Commit Message

Stephen Finucane June 24, 2018, 7:55 p.m. UTC
Python 3.5 and 3.5 introduce raise some warnings for libraries included
in stdlib. Silence these to keep the output clean.

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 tox.ini | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Daniel Axtens Aug. 25, 2018, 3:09 a.m. UTC | #1
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
Stephen Finucane Aug. 29, 2018, 10:05 a.m. UTC | #2
On Sat, 2018-08-25 at 13:09 +1000, Daniel Axtens wrote:
> 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.

These were all issues occurring in the standard library (which should
probably be fixed there, but I guess it's too late in the support cycle
for the given releases to go fix these now). However...

> 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?

If this works, I'm happy with it. We'll see in the next few days :)

Stephen
diff mbox series

Patch

diff --git a/tox.ini b/tox.ini
index 4eef4c44..a190fa6f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,12 +16,14 @@  setenv =
     DJANGO_SETTINGS_MODULE = patchwork.settings.dev
     PYTHONDONTWRITEBYTECODE = 1
     DJANGO_LIVE_TEST_SERVER_ADDRESS = localhost:9000-9200
+    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
 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