From a3b52662d11f89a16e03e6908f19c9aa90f206c7 Mon Sep 17 00:00:00 2001 From: "Dave St.Germain" Date: Mon, 19 Aug 2019 16:27:04 -0400 Subject: [PATCH] Prevent changing dict while iterating --- common/djangoapps/student/tests/factories.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/student/tests/factories.py b/common/djangoapps/student/tests/factories.py index 90d4f30a79..d948e9ec92 100644 --- a/common/djangoapps/student/tests/factories.py +++ b/common/djangoapps/student/tests/factories.py @@ -135,7 +135,7 @@ class CourseEnrollmentFactory(DjangoModelFactory): def _create(cls, model_class, *args, **kwargs): manager = cls._get_manager(model_class) course_kwargs = {} - for key in kwargs.keys(): + for key in list(kwargs): if key.startswith('course__'): course_kwargs[key.split('__')[1]] = kwargs.pop(key)