Skip to content

Commit 13609b2

Browse files
committed
Python: Move pathlib tests to Python 3 only tests
1 parent e2facd0 commit 13609b2

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from pathlib import Path, PosixPath, WindowsPath
2+
3+
p = Path("filepath")
4+
posix = PosixPath("posix/filepath")
5+
windows = WindowsPath("windows/filepath")
6+
7+
p.chmod(0o777) # $getAPathArgument=p
8+
posix.chmod(0o777) # $getAPathArgument=posix
9+
windows.chmod(0o777) # $getAPathArgument=windows
10+
11+
with p.open() as f: # $getAPathArgument=p
12+
f.read()
13+
14+
p.write_bytes(b"hello") # $getAPathArgument=p
15+
16+
name = windows.parent.name
17+
o = open
18+
o(name) # $getAPathArgument=name
19+
20+
wb = p.write_bytes
21+
wb(b"hello") # $getAPathArgument=p

python/ql/test/library-tests/frameworks/stdlib/FileSystemAccess.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,3 @@
1616

1717
io.open("filepath") # $getAPathArgument="filepath"
1818
io.open(file="filepath") # $getAPathArgument="filepath"
19-
20-
from pathlib import Path, PosixPath, WindowsPath
21-
22-
p = Path("filepath")
23-
posix = PosixPath("posix/filepath")
24-
windows = WindowsPath("windows/filepath")
25-
26-
p.chmod(0o777) # $getAPathArgument=p
27-
posix.chmod(0o777) # $getAPathArgument=posix
28-
windows.chmod(0o777) # $getAPathArgument=windows
29-
30-
with p.open() as f: # $getAPathArgument=p
31-
f.read()
32-
33-
p.write_bytes(b"hello") # $getAPathArgument=p
34-
35-
name = windows.parent.name
36-
o(name) # $getAPathArgument=name
37-
38-
wb = p.write_bytes
39-
wb(b"hello") # $getAPathArgument=p

0 commit comments

Comments
 (0)