File tree 1 file changed +8
-0
lines changed 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,10 @@ def tmp_path_ro(tmp_path: Path) -> Iterator[Path]:
83
83
84
84
@pytest .mark .parametrize ("lock_type" , [FileLock , SoftFileLock ])
85
85
@pytest .mark .skipif (sys .platform == "win32" , reason = "Windows does not have read only folders" )
86
+ @pytest .mark .skipif (
87
+ sys .platform != "win32" and os .geteuid () == 0 , # noqa: SC200
88
+ reason = "Cannot make a read only file (that the current user: root can't read)" ,
89
+ )
86
90
def test_ro_folder (lock_type : type [BaseFileLock ], tmp_path_ro : Path ) -> None :
87
91
lock = lock_type (str (tmp_path_ro / "a" ))
88
92
with pytest .raises (PermissionError , match = "Permission denied" ):
@@ -98,6 +102,10 @@ def tmp_file_ro(tmp_path: Path) -> Iterator[Path]:
98
102
99
103
100
104
@pytest .mark .parametrize ("lock_type" , [FileLock , SoftFileLock ])
105
+ @pytest .mark .skipif (
106
+ sys .platform != "win32" and os .geteuid () == 0 , # noqa: SC200
107
+ reason = "Cannot make a read only file (that the current user: root can't read)" ,
108
+ )
101
109
def test_ro_file (lock_type : type [BaseFileLock ], tmp_file_ro : Path ) -> None :
102
110
lock = lock_type (str (tmp_file_ro ))
103
111
with pytest .raises (PermissionError , match = "Permission denied" ):
You can’t perform that action at this time.
0 commit comments