Skip to content

Commit 01d6f1d

Browse files
committed
Use jaraco.path for more tests
1 parent 00608cb commit 01d6f1d

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

distutils/tests/test_dist.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,26 @@ def test_venv_install_options(self, request):
101101

102102
fakepath = '/somedir'
103103

104-
with open(TESTFN, "w") as f:
105-
print(
106-
(
107-
"[install]\n"
108-
"install-base = {0}\n"
109-
"install-platbase = {0}\n"
110-
"install-lib = {0}\n"
111-
"install-platlib = {0}\n"
112-
"install-purelib = {0}\n"
113-
"install-headers = {0}\n"
114-
"install-scripts = {0}\n"
115-
"install-data = {0}\n"
116-
"prefix = {0}\n"
117-
"exec-prefix = {0}\n"
118-
"home = {0}\n"
119-
"user = {0}\n"
120-
"root = {0}"
121-
).format(fakepath),
122-
file=f,
123-
)
104+
jaraco.path.build(
105+
{
106+
TESTFN: f"""
107+
[install]
108+
install-base = {fakepath}
109+
install-platbase = {fakepath}
110+
install-lib = {fakepath}
111+
install-platlib = {fakepath}
112+
install-purelib = {fakepath}
113+
install-headers = {fakepath}
114+
install-scripts = {fakepath}
115+
install-data = {fakepath}
116+
prefix = {fakepath}
117+
exec-prefix = {fakepath}
118+
home = {fakepath}
119+
user = {fakepath}
120+
root = {fakepath}
121+
""",
122+
}
123+
)
124124

125125
# Base case: Not in a Virtual Environment
126126
with mock.patch.multiple(sys, prefix='/a', base_prefix='/a'):
@@ -161,12 +161,14 @@ def test_venv_install_options(self, request):
161161
def test_command_packages_configfile(self, request, clear_argv):
162162
sys.argv.append("build")
163163
request.addfinalizer(functools.partial(os.unlink, TESTFN))
164-
f = open(TESTFN, "w")
165-
try:
166-
print("[global]", file=f)
167-
print("command_packages = foo.bar, splat", file=f)
168-
finally:
169-
f.close()
164+
jaraco.path.build(
165+
{
166+
TESTFN: """
167+
[global]
168+
command_packages = foo.bar, splat
169+
""",
170+
}
171+
)
170172

171173
d = self.create_distribution([TESTFN])
172174
assert d.get_command_packages() == ["distutils.command", "foo.bar", "splat"]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy