Mercurial > hg
comparison tests/hghave.py @ 25090:252412e24551
hghave: use try/except/finally
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 May 2015 10:29:39 -0500 |
parents | b76d8c641746 |
children | 6f15114bdcc3 |
comparison
equal
deleted
inserted
replaced
25089:c6427cd45760 | 25090:252412e24551 |
---|---|
223 from mercurial import util | 223 from mercurial import util |
224 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) | 224 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) |
225 os.close(fh) | 225 os.close(fh) |
226 name = tempfile.mktemp(dir='.', prefix=tempprefix) | 226 name = tempfile.mktemp(dir='.', prefix=tempprefix) |
227 try: | 227 try: |
228 try: | 228 util.oslink(fn, name) |
229 util.oslink(fn, name) | 229 os.unlink(name) |
230 os.unlink(name) | 230 return True |
231 return True | 231 except OSError: |
232 except OSError: | 232 return False |
233 return False | |
234 finally: | 233 finally: |
235 os.unlink(fn) | 234 os.unlink(fn) |
236 | 235 |
237 @check("tla", "GNU Arch tla client") | 236 @check("tla", "GNU Arch tla client") |
238 def has_tla(): | 237 def has_tla(): |