This is an automated email from the ASF dual-hosted git repository.
potiuk 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 00d54c04c4 Refactor: Use tmp_path in breeze/tests (#33739)
00d54c04c4 is described below
commit 00d54c04c47d8c113d4edabc395bcedf6d4d3c6d
Author: Miroslav Šedivý <[email protected]>
AuthorDate: Sun Aug 27 16:36:38 2023 +0000
Refactor: Use tmp_path in breeze/tests (#33739)
---
dev/breeze/tests/test_run_utils.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dev/breeze/tests/test_run_utils.py
b/dev/breeze/tests/test_run_utils.py
index 2ff2fb8810..46e98c731d 100644
--- a/dev/breeze/tests/test_run_utils.py
+++ b/dev/breeze/tests/test_run_utils.py
@@ -16,9 +16,7 @@
# under the License.
from __future__ import annotations
-import os
import stat
-from pathlib import Path
from airflow_breeze.utils.run_utils import (
change_directory_permission,
@@ -27,17 +25,19 @@ from airflow_breeze.utils.run_utils import (
)
-def test_change_file_permission(tmpdir):
- tmpfile = Path(tmpdir, "test.config")
+def test_change_file_permission(tmp_path):
+ tmpfile = tmp_path / "test.config"
tmpfile.write_text("content")
change_file_permission(tmpfile)
- mode = os.stat(tmpfile).st_mode
+ mode = tmpfile.stat().st_mode
assert not (mode & stat.S_IWGRP) and not (mode & stat.S_IWOTH)
-def test_change_directory_permission(tmpdir):
- change_directory_permission(tmpdir)
- mode = os.stat(tmpdir).st_mode
+def test_change_directory_permission(tmp_path):
+ subdir = tmp_path / "testdir"
+ subdir.mkdir()
+ change_directory_permission(subdir)
+ mode = subdir.stat().st_mode
assert (
not (mode & stat.S_IWGRP)
and not (mode & stat.S_IWOTH)