-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtest_perms.py
More file actions
26 lines (18 loc) · 700 Bytes
/
test_perms.py
File metadata and controls
26 lines (18 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sys
import pytest
import fsutil
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Test skipped on Windows")
def test_get_permissions(temp_path):
path = temp_path("a/b/c.txt")
fsutil.write_file(path, content="Hello World")
permissions = fsutil.get_permissions(path)
assert permissions == 644
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Test skipped on Windows")
def test_set_permissions(temp_path):
path = temp_path("a/b/c.txt")
fsutil.write_file(path, content="Hello World")
fsutil.set_permissions(path, 777)
permissions = fsutil.get_permissions(path)
assert permissions == 777
if __name__ == "__main__":
pytest.main()