[PATCH 10/11] tox: Rework warning infrastructure

Stephen Finucane stephen at that.guru
Wed Aug 29 20:05:34 AEST 2018


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



More information about the Patchwork mailing list