turbaszek commented on a change in pull request #14663:
URL: https://github.com/apache/airflow/pull/14663#discussion_r593031989



##########
File path: airflow/operators/python.py
##########
@@ -489,7 +489,9 @@ def __init__(  # pylint: disable=too-many-arguments
         self.pickling_library = dill if self.use_dill else pickle
 
     def execute(self, context: Dict):
-        serializable_context = {key: context[key] for key in 
self._get_serializable_context_keys()}
+        serializable_context = {
+            key: context[key] for key in self._get_serializable_context_keys() 
if context.get(key) is not None
+        }

Review comment:
       @cccs-seb have you tried using `mock.MagicMock()` as context? In this 
way we probably won't need this change and we can do even more - for example 
assert that some values from the context were accessed. WDYT?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to