From 36f0a71e037cae883d2f602a07c63c3208fff518 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 11 Apr 2018 02:22:14 +0100 Subject: [PATCH] Bug 1389517 - Make Python warnings fatal during pytest runs This makes most warning types (including the normally hidden `DeprecatonWarning`s) fatal during pytest runs, to help prevent regressions now that most of them have been fixed. See: https://docs.pytest.org/en/latest/warnings.html https://docs.python.org/2.7/library/warnings.html#warning-categories --- setup.cfg | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/setup.cfg b/setup.cfg index c538339b5..3ff8549ee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,6 +31,17 @@ norecursedirs = __pycache__ jenkins ui DJANGO_SETTINGS_MODULE=tests.settings # Disable unused auto-loaded plugins. addopts = --driver Firefox -p no:mozlog -p no:metadata -p no:html +# Make most warnings fatal (including the hidden by default DeprecationWarning): +# https://docs.pytest.org/en/latest/warnings.html +# https://docs.python.org/2.7/library/warnings.html#warning-categories +# Note that some warnings are currently missed by pytest: +# https://github.com/pytest-dev/pytest/issues/3251 +filterwarnings = + error + # TODO: Fix usages of `selenium` and remove this override. + default:use driver instead:DeprecationWarning:pypom.view + ignore::ImportWarning + ignore::PendingDeprecationWarning markers = slow: mark a test as slow. xfail_strict = true