This is an automated email from the ASF dual-hosted git repository.

husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 82c3e2d39a Use path.write_text for text (#33590)
82c3e2d39a is described below

commit 82c3e2d39abc05070552324429335bfb6aef925f
Author: Miroslav Šedivý <[email protected]>
AuthorDate: Mon Aug 21 20:07:05 2023 +0000

    Use path.write_text for text (#33590)
---
 tests/providers/cncf/kubernetes/operators/test_pod.py | 4 ++--
 tests/providers/slack/hooks/test_slack.py             | 4 ++--
 tests/utils/test_email.py                             | 4 ++--
 tests/utils/test_serve_logs.py                        | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/providers/cncf/kubernetes/operators/test_pod.py 
b/tests/providers/cncf/kubernetes/operators/test_pod.py
index 7b40103dac..9eb3e2bcc1 100644
--- a/tests/providers/cncf/kubernetes/operators/test_pod.py
+++ b/tests/providers/cncf/kubernetes/operators/test_pod.py
@@ -779,7 +779,7 @@ class TestKubernetesPodOperator:
 
     @pytest.fixture
     def pod_template_file(self, tmp_path):
-        pod_template_yaml = b"""
+        pod_template_yaml = """
             apiVersion: v1
             kind: Pod
             metadata:
@@ -817,7 +817,7 @@ class TestKubernetesPodOperator:
         """
 
         tpl_file = tmp_path / "template.yaml"
-        tpl_file.write_bytes(pod_template_yaml)
+        tpl_file.write_text(pod_template_yaml)
 
         yield tpl_file
 
diff --git a/tests/providers/slack/hooks/test_slack.py 
b/tests/providers/slack/hooks/test_slack.py
index 9e12c30a79..c13e6c267f 100644
--- a/tests/providers/slack/hooks/test_slack.py
+++ b/tests/providers/slack/hooks/test_slack.py
@@ -370,7 +370,7 @@ class TestSlackHook:
 
         tmp = tmp_path_factory.mktemp("test_send_file_path")
         file = tmp / "test.json"
-        file.write_bytes(b'{"foo": "bar"}')
+        file.write_text('{"foo": "bar"}')
 
         hook = SlackHook(slack_conn_id=SLACK_API_DEFAULT_CONN_ID)
         hook.send_file(
@@ -405,7 +405,7 @@ class TestSlackHook:
 
         tmp = tmp_path_factory.mktemp("test_send_file_path_set_filename")
         file = tmp / filename
-        file.write_bytes(b'{"foo": "bar"}')
+        file.write_text('{"foo": "bar"}')
 
         hook = SlackHook(slack_conn_id=SLACK_API_DEFAULT_CONN_ID)
         hook.send_file(file=file)
diff --git a/tests/utils/test_email.py b/tests/utils/test_email.py
index a970cb4f6f..f5b6805de3 100644
--- a/tests/utils/test_email.py
+++ b/tests/utils/test_email.py
@@ -149,7 +149,7 @@ class TestEmailSmtp:
     @mock.patch("airflow.utils.email.send_mime_email")
     def test_send_smtp(self, mock_send_mime, tmp_path):
         path = tmp_path / "testfile"
-        path.write_bytes(b"attachment")
+        path.write_text("attachment")
         email.send_email_smtp("to", "subject", "content", 
files=[os.fspath(path)])
         assert mock_send_mime.called
         _, call_args = mock_send_mime.call_args
@@ -176,7 +176,7 @@ class TestEmailSmtp:
     @mock.patch("airflow.utils.email.send_mime_email")
     def test_send_bcc_smtp(self, mock_send_mime, tmp_path):
         path = tmp_path / "testfile"
-        path.write_bytes(b"attachment")
+        path.write_text("attachment")
         email.send_email_smtp(
             "to",
             "subject",
diff --git a/tests/utils/test_serve_logs.py b/tests/utils/test_serve_logs.py
index 5b751312d3..574686a415 100644
--- a/tests/utils/test_serve_logs.py
+++ b/tests/utils/test_serve_logs.py
@@ -75,7 +75,7 @@ def sample_log(request, tmp_path):
         raise ValueError(f"Unknown client fixture: {client}")
 
     f = base_log_dir.joinpath("sample.log")
-    f.write_bytes(LOG_DATA.encode())
+    f.write_text(LOG_DATA)
     return f
 
 

Reply via email to