comparison tests/hghave.py @ 20114:390aff33c2f9

tests: fix `hghave root` on windows This lets tests\test-hghave.t pass on windows where geteuid does not exist.
author Simon Heimberg <simohe@besonet.ch>
date Sat, 23 Nov 2013 01:06:20 +0100
parents e54a078153f7
children e457321a5687
comparison
equal deleted inserted replaced
20113:7ad2ae7792ad 20114:390aff33c2f9
232 return True 232 return True
233 finally: 233 finally:
234 os.rmdir(d) 234 os.rmdir(d)
235 235
236 def has_root(): 236 def has_root():
237 return os.geteuid() == 0 237 return getattr(os, 'geteuid', None) and os.geteuid() == 0
238 238
239 def has_pyflakes(): 239 def has_pyflakes():
240 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"", 240 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
241 r"<stdin>:1: 're' imported but unused", 241 r"<stdin>:1: 're' imported but unused",
242 True) 242 True)