Show More
@@ -270,20 +270,25 b' class TempFileMixin(object):' | |||
|
270 | 270 | def mktmp(self, src, ext='.py'): |
|
271 | 271 | """Make a valid python temp file.""" |
|
272 | 272 | fname, f = temp_pyfile(src, ext) |
|
273 | self.tmpfile = f | |
|
273 | if not hasattr(self, 'tmps'): | |
|
274 | self.tmps=[] | |
|
275 | self.tmps.append((f, fname)) | |
|
274 | 276 | self.fname = fname |
|
275 | 277 | |
|
276 | 278 | def tearDown(self): |
|
277 | if hasattr(self, 'tmpfile'): | |
|
278 | # If the tmpfile wasn't made because of skipped tests, like in | |
|
279 | # win32, there's nothing to cleanup. | |
|
280 |
self.tmp |
|
|
281 | try: | |
|
282 | os.unlink(self.fname) | |
|
283 | except: | |
|
284 | # On Windows, even though we close the file, we still can't | |
|
285 | # delete it. I have no clue why | |
|
286 |
|
|
|
279 | # If the tmpfile wasn't made because of skipped tests, like in | |
|
280 | # win32, there's nothing to cleanup. | |
|
281 | if hasattr(self, 'tmps'): | |
|
282 | for f,fname in self.tmps: | |
|
283 | # If the tmpfile wasn't made because of skipped tests, like in | |
|
284 | # win32, there's nothing to cleanup. | |
|
285 | f.close() | |
|
286 | try: | |
|
287 | os.unlink(fname) | |
|
288 | except: | |
|
289 | # On Windows, even though we close the file, we still can't | |
|
290 | # delete it. I have no clue why | |
|
291 | pass | |
|
287 | 292 | |
|
288 | 293 | def __enter__(self): |
|
289 | 294 | return self |
General Comments 0
You need to be logged in to leave comments.
Login now