[FIX] testfile: can import during iteration

Hence modifying sys.modules blowing up the iterator.
This commit is contained in:
xmo-odoo
2017-05-15 10:08:38 +02:00
committed by GitHub
parent 4ad1ae6896
commit 54ae611131
+1 -1
View File
@@ -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: