common/test/unittest_mail.py
changeset 3163 edfe43ceaa35
parent 2773 b2530e3e0afb
parent 3153 93ce84956679
--- a/common/test/unittest_mail.py	Wed Sep 02 16:42:07 2009 +0200
+++ b/common/test/unittest_mail.py	Thu Sep 10 08:13:22 2009 +0200
@@ -8,7 +8,7 @@
 """
 
 import os
-import pwd
+import sys
 
 from logilab.common.testlib import unittest_main
 from logilab.common.umessage import message_from_string
@@ -22,7 +22,11 @@
     (man 3 getlogin)
     Another solution would be to use $LOGNAME, $USER or $USERNAME
     """
-    return pwd.getpwuid(os.getuid())[0]
+    if sys.platform != 'win32':
+        import pwd
+        return pwd.getpwuid(os.getuid())[0]
+    else:
+        return os.environ.get('USERNAME')
 
 
 class EmailTC(CubicWebTC):