Skip to content

Commit 61f9dd8

Browse files
author
Paul Sokolovsky
committed
os.path: test_path.py: Use paths relative to module dir.
Allows to run via test aggregators.
1 parent e9b5460 commit 61f9dd8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

os.path/test_path.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import sys
2-
sys.path[0] = "os"
2+
3+
dir = "."
4+
if "/" in __file__:
5+
dir = __file__.rsplit("/", 1)[0]
6+
7+
sys.path[0] = dir + "/os"
38
from path import *
49

510
assert split("") == ("", "")
@@ -9,9 +14,9 @@
914
assert split("/foo/") == ("/foo", "")
1015
assert split("/foo/bar") == ("/foo", "bar")
1116

12-
assert exists("test_path.py")
13-
assert not exists("test_path.py--")
17+
assert exists(dir + "/test_path.py")
18+
assert not exists(dir + "/test_path.py--")
1419

15-
assert isdir("os")
16-
assert not isdir("os--")
17-
assert not isdir("test_path.py")
20+
assert isdir(dir + "/os")
21+
assert not isdir(dir + "/os--")
22+
assert not isdir(dir + "/test_path.py")

0 commit comments

Comments
 (0)