Patchwork tests: fix `hghave root` on windows

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 23, 2013, 12:08 a.m.
Message ID <0dfc3aab13a0ea8a15fd.1385165296@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3100/
State Accepted
Commit 390aff33c2f9b6a02e887ef02219bb426f96d437
Headers show

Comments

Simon Heimberg - Nov. 23, 2013, 12:08 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1385165180 -3600
#      Sat Nov 23 01:06:20 2013 +0100
# Node ID 0dfc3aab13a0ea8a15fded651ae1b2a8f514afa1
# Parent  7f0b0f63018df842f843c6e8faabddf64a52b0cc
tests: fix `hghave root` on windows

This lets tests\test-hghave.t pass on windows where geteuid does not exist.

Patch

diff -r 7f0b0f63018d -r 0dfc3aab13a0 tests/hghave.py
--- a/tests/hghave.py	Fri Nov 22 16:21:21 2013 +0100
+++ b/tests/hghave.py	Sat Nov 23 01:06:20 2013 +0100
@@ -234,7 +234,7 @@ 
         os.rmdir(d)
 
 def has_root():
-    return os.geteuid() == 0
+    return getattr(os, 'geteuid', None) and os.geteuid() == 0
 
 def has_pyflakes():
     return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",