From 8db86a8274501b320c16bfcac4bf906b4545a339 Mon Sep 17 00:00:00 2001 From: medmunds Date: Tue, 12 May 2015 18:42:12 -0700 Subject: [PATCH] Fix RuntimeError on sys.modules in reset_warning_registry Django 1.8's reset_warning_registry (which we backport) was generating `RuntimeError: dictionary changed size during iteration` in Travis tests under Python 3.x. Likely a thread-safety issue on sys.modules.values(). See https://code.djangoproject.com/ticket/21049 for fix applied elsewhere in Django. --- djrill/tests/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/djrill/tests/utils.py b/djrill/tests/utils.py index 8601082..fc372e9 100644 --- a/djrill/tests/utils.py +++ b/djrill/tests/utils.py @@ -91,6 +91,7 @@ class BackportedAssertions(object): # Backport from Django 1.8 (django.test.utils) +# with fix suggested by https://code.djangoproject.com/ticket/21049 def reset_warning_registry(): """ Clear warning registry for all modules. This is required in some tests @@ -100,6 +101,6 @@ def reset_warning_registry(): The bug was fixed in Python 3.4.2. """ key = "__warningregistry__" - for mod in sys.modules.values(): + for mod in list(sys.modules.values()): if hasattr(mod, key): getattr(mod, key).clear()