equal
deleted
inserted
replaced
6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 import pwd |
11 import sys |
12 |
12 |
13 from logilab.common.testlib import unittest_main |
13 from logilab.common.testlib import unittest_main |
14 from logilab.common.umessage import message_from_string |
14 from logilab.common.umessage import message_from_string |
15 |
15 |
16 from cubicweb.devtools.apptest import EnvBasedTC |
16 from cubicweb.devtools.apptest import EnvBasedTC |
20 def getlogin(): |
20 def getlogin(): |
21 """avoid usinng os.getlogin() because of strange tty / stdin problems |
21 """avoid usinng os.getlogin() because of strange tty / stdin problems |
22 (man 3 getlogin) |
22 (man 3 getlogin) |
23 Another solution would be to use $LOGNAME, $USER or $USERNAME |
23 Another solution would be to use $LOGNAME, $USER or $USERNAME |
24 """ |
24 """ |
25 return pwd.getpwuid(os.getuid())[0] |
25 if sys.platform != 'win32': |
|
26 import pwd |
|
27 return pwd.getpwuid(os.getuid())[0] |
|
28 else: |
|
29 return os.environ.get('USERNAME') |
26 |
30 |
27 |
31 |
28 class EmailTC(EnvBasedTC): |
32 class EmailTC(EnvBasedTC): |
29 |
33 |
30 def test_format_mail(self): |
34 def test_format_mail(self): |