You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/04 12:12:42 UTC

[GitHub] [airflow] ashb commented on a change in pull request #21323: Use mocking for Docker decorator tests

ashb commented on a change in pull request #21323:
URL: https://github.com/apache/airflow/pull/21323#discussion_r799412827



##########
File path: tests/providers/docker/decorators/test_docker.py
##########
@@ -15,16 +15,41 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import sys
+import tempfile
+from base64 import b64decode
+from unittest.mock import patch
+
 from airflow.decorators import task
 from airflow.models.dag import DAG
+from airflow.providers.docker.operators.docker import DockerOperator
 from airflow.utils import timezone
 
 DEFAULT_DATE = timezone.datetime(2021, 9, 1)
 
+DOCKER_IMAGE = "quay.io/bitnami/python:3.9"
+
+
+def docker_execute(self, context):
+    code = b64decode(self.environment['__PYTHON_SCRIPT'])
+    args = b64decode(self.environment['__PYTHON_INPUT'])
+    with tempfile.NamedTemporaryFile() as f:
+        with tempfile.NamedTemporaryFile() as g:

Review comment:
       ```suggestion
       with tempfile.NamedTemporaryFile() as f, tempfile.NamedTemporaryFile() as g:
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org