From 8c88de9d93fc83296fdba3d90d77dac2641d8a19 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Wed, 13 May 2015 09:39:02 +0100 Subject: [PATCH] Show ResourceWarnings when running tests This warning is raised when a file is opened inside a test, but not closed. This can help spot bugs in Wagtail. ResourceWarning was added in Python 3.2 and isn't available in Python 2 --- runtests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtests.py b/runtests.py index a1925f907d..8e0cac6ac5 100755 --- a/runtests.py +++ b/runtests.py @@ -17,6 +17,10 @@ def runtests(): warnings.simplefilter('default', DeprecationWarning) warnings.simplefilter('default', PendingDeprecationWarning) + # Don't ignore ResourceWarnings (Python 3 only) + if sys.version_info >= (3, 0): + warnings.simplefilter('default', ResourceWarning) + argv = sys.argv[:1] + ['test'] + sys.argv[1:] try: execute_from_command_line(argv)