@@ -33,7 +33,6 @@ def ensure_removed(path):
33
33
34
34
@contextmanager
35
35
def temp_directory (files = None ):
36
-
37
36
temp_dir = tempfile .mkdtemp ()
38
37
print (temp_dir )
39
38
try :
@@ -135,26 +134,32 @@ def test_role_run_abs():
135
134
136
135
137
136
def test_role_logfile ():
138
-
139
- rc = main (['-r' , 'benthomasson.hello_role' ,
140
- '--hosts' , 'localhost' ,
141
- '--roles-path' , 'test/integration/project/roles' ,
142
- '--logfile' , 'new_logfile' ,
143
- 'run' ,
144
- 'test/integration' ])
145
- assert rc == 0
146
- ensure_removed ("test/integration/artifacts" )
147
-
148
-
149
- def test_role_logfile_abs ():
150
- with temp_directory () as temp_dir :
137
+ try :
151
138
rc = main (['-r' , 'benthomasson.hello_role' ,
152
139
'--hosts' , 'localhost' ,
153
- '--roles-path' , os . path . join ( HERE , ' project/roles') ,
140
+ '--roles-path' , 'test/integration/ project/roles' ,
154
141
'--logfile' , 'new_logfile' ,
155
142
'run' ,
156
- temp_dir ])
157
- assert rc == 0
143
+ 'test/integration' ])
144
+ assert os .path .exists ('new_logfile' )
145
+ assert rc == 0
146
+ finally :
147
+ ensure_removed ("test/integration/artifacts" )
148
+
149
+
150
+ def test_role_logfile_abs ():
151
+ try :
152
+ with temp_directory () as temp_dir :
153
+ rc = main (['-r' , 'benthomasson.hello_role' ,
154
+ '--hosts' , 'localhost' ,
155
+ '--roles-path' , os .path .join (HERE , 'project/roles' ),
156
+ '--logfile' , 'new_logfile' ,
157
+ 'run' ,
158
+ temp_dir ])
159
+ assert os .path .exists ('new_logfile' )
160
+ assert rc == 0
161
+ finally :
162
+ ensure_removed ("new_logfile" )
158
163
159
164
160
165
def test_role_bad_project_dir ():
@@ -172,6 +177,7 @@ def test_role_bad_project_dir():
172
177
'bad_project_dir' ])
173
178
finally :
174
179
os .unlink ('bad_project_dir' )
180
+ ensure_removed ("new_logfile" )
175
181
176
182
177
183
def test_role_run_clean ():
@@ -206,20 +212,6 @@ def test_role_run_artifacts_dir():
206
212
ensure_removed ("test/integration/artifacts" )
207
213
208
214
209
- def test_role_run_artifacts_dir_abs ():
210
- with temp_directory () as temp_dir :
211
- rc = main (['-r' , 'benthomasson.hello_role' ,
212
- '--hosts' , 'localhost' ,
213
- '--roles-path' , 'test/integration/roles' ,
214
- '--artifact-dir' , os .path .join (tmpdir , 'otherartifacts' ),
215
- 'run' ,
216
- "test/integration" ])
217
- assert os .path .exists (os .path .join (tmpdir , 'otherartifacts' ))
218
- assert rc == 0
219
- finally :
220
- shutil .rmtree (tmpdir )
221
-
222
-
223
215
def test_role_run_artifacts_dir_abs ():
224
216
try :
225
217
with temp_directory () as temp_dir :
0 commit comments