diff --git a/odoo/service/server.py b/odoo/service/server.py
index cd1ae39491f57c54b89a540c60a95aea30770959..29b46ae6a7b99ee4a5c242708d08fcb8636737f2 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: