From d944f6591eb8b952cc004e574fd387b489279429 Mon Sep 17 00:00:00 2001 From: "Amerr, Ziad (ext) (DI SW ICS MNA RD QA QST 2)" Date: Mon, 19 May 2025 20:02:59 +0300 Subject: [PATCH 1/4] Skipping permission test error if the user has root privileges --- tests/resources/test_file_resources.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/resources/test_file_resources.py b/tests/resources/test_file_resources.py index cb622229a..4d2bc63cf 100644 --- a/tests/resources/test_file_resources.py +++ b/tests/resources/test_file_resources.py @@ -99,7 +99,8 @@ class TestFileResource: await resource.read() @pytest.mark.skipif( - os.name == "nt", reason="File permissions behave differently on Windows" + os.name == "nt" or os.getuid() == 0, + reason="File permissions behave differently on Windows or when running as root" ) async def test_permission_error(self, temp_file: Path): """Test reading a file without permissions.""" From 1393a2bb0625ea8df5196cc9678cff40a4bb3cad Mon Sep 17 00:00:00 2001 From: "Amerr, Ziad (ext) (DI SW ICS MNA RD QA QST 2)" Date: Mon, 19 May 2025 20:12:07 +0300 Subject: [PATCH 2/4] Reformatting, and adding copilot's suggestion --- tests/resources/test_file_resources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/resources/test_file_resources.py b/tests/resources/test_file_resources.py index 4d2bc63cf..06f4576d5 100644 --- a/tests/resources/test_file_resources.py +++ b/tests/resources/test_file_resources.py @@ -99,8 +99,8 @@ class TestFileResource: await resource.read() @pytest.mark.skipif( - os.name == "nt" or os.getuid() == 0, - reason="File permissions behave differently on Windows or when running as root" + os.name == "nt" or (hasattr(os, 'getuid') and os.getuid() == 0), + reason="File permissions behave differently on Windows or when running as root", ) async def test_permission_error(self, temp_file: Path): """Test reading a file without permissions.""" From 2bf349b09fb2237ab5d1ecb511a9959879edbc32 Mon Sep 17 00:00:00 2001 From: "Amerr, Ziad (ext) (DI SW ICS MNA RD QA QST 2)" Date: Mon, 19 May 2025 20:13:52 +0300 Subject: [PATCH 3/4] Fixed formatting again --- tests/resources/test_file_resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/resources/test_file_resources.py b/tests/resources/test_file_resources.py index 06f4576d5..2e3f7e153 100644 --- a/tests/resources/test_file_resources.py +++ b/tests/resources/test_file_resources.py @@ -99,7 +99,7 @@ class TestFileResource: await resource.read() @pytest.mark.skipif( - os.name == "nt" or (hasattr(os, 'getuid') and os.getuid() == 0), + os.name == "nt" or (hasattr(os, "getuid") and os.getuid() == 0), reason="File permissions behave differently on Windows or when running as root", ) async def test_permission_error(self, temp_file: Path): From 4561d722ad77f070a678cfe4341d5baa6a4f08d5 Mon Sep 17 00:00:00 2001 From: "Amerr, Ziad (ext) (DI SW ICS MNA RD QA QST 2)" Date: Mon, 19 May 2025 20:14:59 +0300 Subject: [PATCH 4/4] Removed trailing whitespace --- tests/resources/test_file_resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/resources/test_file_resources.py b/tests/resources/test_file_resources.py index 2e3f7e153..5f355e360 100644 --- a/tests/resources/test_file_resources.py +++ b/tests/resources/test_file_resources.py @@ -99,7 +99,7 @@ class TestFileResource: await resource.read() @pytest.mark.skipif( - os.name == "nt" or (hasattr(os, "getuid") and os.getuid() == 0), + os.name == "nt" or (hasattr(os, "getuid") and os.getuid() == 0), reason="File permissions behave differently on Windows or when running as root", ) async def test_permission_error(self, temp_file: Path):