Skip to content

Commit 12c9c62

Browse files
CI: Skip permissions test when running as sudo (#33847)
1 parent 921d010 commit 12c9c62

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/io/parser/test_common.py

+9
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,15 @@ def test_no_permission(all_parsers):
974974
msg = r"\[Errno 13\]"
975975
with tm.ensure_clean() as path:
976976
os.chmod(path, 0) # make file unreadable
977+
978+
# verify that this process cannot open the file (not running as sudo)
979+
try:
980+
with open(path):
981+
pass
982+
pytest.skip("Running as sudo.")
983+
except PermissionError:
984+
pass
985+
977986
with pytest.raises(PermissionError, match=msg) as e:
978987
parser.read_csv(path)
979988
assert path == e.value.filename

0 commit comments

Comments
 (0)