[skeleton/pytestconf] provide an acceptable solution for windows, closes #1875488 oldstable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 26 Jul 2011 16:05:36 +0200
brancholdstable
changeset 7693 e2f75311d7be
parent 7676 cc3987eb793c
child 7694 bd56a29acaa8
[skeleton/pytestconf] provide an acceptable solution for windows, closes #1875488
skeleton/test/pytestconf.py
--- a/skeleton/test/pytestconf.py	Wed Jul 20 18:21:47 2011 +0200
+++ b/skeleton/test/pytestconf.py	Tue Jul 26 16:05:36 2011 +0200
@@ -19,7 +19,7 @@
 
 """
 import os
-import pwd
+import sys
 
 from logilab.common.pytest import PyTester
 
@@ -28,6 +28,9 @@
     (man 3 getlogin)
     Another solution would be to use $LOGNAME, $USER or $USERNAME
     """
+    if sys.platform == 'win32':
+        return os.environ.get('USERNAME') or 'cubicweb'
+    import pwd
     return pwd.getpwuid(os.getuid())[0]