Show More
@@ -270,16 +270,21 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 | 279 |
|
|
279 | 280 |
|
|
280 | self.tmpfile.close() | |
|
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() | |
|
281 | 286 | try: |
|
282 |
os.unlink( |
|
|
287 | os.unlink(fname) | |
|
283 | 288 | except: |
|
284 | 289 | # On Windows, even though we close the file, we still can't |
|
285 | 290 | # delete it. I have no clue why |
General Comments 0
You need to be logged in to leave comments.
Login now