From 54ae611131ea9004d902a7e44946cdae145eaf42 Mon Sep 17 00:00:00 2001
From: xmo-odoo <xmo@odoo.com>
Date: Mon, 15 May 2017 10:08:38 +0200
Subject: [PATCH] [FIX] testfile: can import during iteration

Hence modifying sys.modules blowing up the iterator.
---
 odoo/service/server.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/odoo/service/server.py b/odoo/service/server.py
index cd1ae39491f5..29b46ae6a7b9 100644
--- a/odoo/service/server.py
+++ b/odoo/service/server.py
@@ -874,7 +874,7 @@ def load_test_file_yml(registry, test_file):
 def load_test_file_py(registry, test_file):
     # Locate python module based on its filename and run the tests
     test_path, _ = os.path.splitext(os.path.abspath(test_file))
-    for mod_name, mod_mod in pycompat.items(sys.modules):
+    for mod_name, mod_mod in list(pycompat.items(sys.modules)):
         if mod_mod:
             mod_path, _ = os.path.splitext(getattr(mod_mod, '__file__', ''))
             if test_path == mod_path:
-- 
GitLab