8000 Simplify using pathlib · bpython/bpython@f229821 · GitHub
[go: up one dir, main page]

Skip to content

Commit f229821

Browse files
committed
Simplify using pathlib
1 parent 7fca6d7 commit f229821

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

bpython/test/test_importcompletion.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import tempfile
33
import unittest
44

5+
from pathlib import Path
56
from bpython.importcompletion import ModuleGatherer
67

78

@@ -60,36 +61,24 @@ def setUp(self):
6061
os.mkdir(os.path.join(import_test_folder, "Left"))
6162

6263
current_path = os.path.join(import_test_folder, "Level0")
63-
with open(
64-
os.path.join(current_path, "__init__.py"), "x"
65-
) as init_file:
66-
pass
64+
Path(os.path.join(current_path, "__init__.py")).touch()
6765

6866
current_path = os.path.join(current_path, "Level1")
6967
os.mkdir(current_path)
70-
with open(
71-
os.path.join(current_path, "__init__.py"), "x"
72-
) as init_file:
73-
pass
68+
Path(os.path.join(current_path, "__init__.py")).touch()
7469

7570
current_path = os.path.join(current_path, "Level2")
7671
os.mkdir(current_path)
77-
with open(
78-
os.path.join(current_path, "__init__.py"), "x"
79-
) as init_file:
80-
pass
72+
Path(os.path.join(current_path, "__init__.py")).touch()
8173

8274
os.symlink(
83-
os.path.join(import_test_folder, "Level0/Level1"),
75+
os.path.join(import_test_folder, "Level0", "Level1"),
8476
os.path.join(current_path, "Level3"),
8577
True,
8678
)
8779

8880
current_path = os.path.join(import_test_folder, "Right")
89-
with open(
90-
os.path.join(current_path, "__init__.py"), "x"
91-
) as init_file:
92-
pass
81+
Path(os.path.join(current_path, "__init__.py")).touch()
9382

9483
os.symlink(
9584
os.path.join(import_test_folder, "Left"),
@@ -98,10 +87,7 @@ def setUp(self):
9887
)
9988

10089
current_path = os.path.join(import_test_folder, "Left")
101-
with open(
102-
os.path.join(current_path, "__init__.py"), "x"
103-
) as init_file:
104-
pass
90+
Path(os.path.join(current_path, "__init__.py")).touch()
10591

10692
os.symlink(
10793
os.path.join(import_test_folder, "Right"),

0 commit comments

Comments
 (0)
0