@@ -101,26 +101,26 @@ def test_venv_install_options(self, request):
101
101
102
102
fakepath = '/somedir'
103
103
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
+ )
124
124
125
125
# Base case: Not in a Virtual Environment
126
126
with mock .patch .multiple (sys , prefix = '/a' , base_prefix = '/a' ):
@@ -161,12 +161,14 @@ def test_venv_install_options(self, request):
161
161
def test_command_packages_configfile (self , request , clear_argv ):
162
162
sys .argv .append ("build" )
163
163
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
+ )
170
172
171
173
d = self .create_distribution ([TESTFN ])
172
174
assert d .get_command_packages () == ["distutils.command" , "foo.bar" , "splat" ]
0 commit comments