author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Fri, 20 Aug 2010 08:35:10 +0200 | |
branch | stable |
changeset 6129 | fea746b60093 |
parent 5424 | 8ecbcbff9777 |
child 7693 | e2f75311d7be |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
1 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5165
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
18 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
19 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
20 |
""" |
0 | 21 |
import os |
22 |
import pwd |
|
23 |
||
24 |
from logilab.common.pytest import PyTester |
|
25 |
||
26 |
def getlogin(): |
|
27 |
"""avoid usinng os.getlogin() because of strange tty / stdin problems |
|
28 |
(man 3 getlogin) |
|
29 |
Another solution would be to use $LOGNAME, $USER or $USERNAME |
|
30 |
""" |
|
31 |
return pwd.getpwuid(os.getuid())[0] |
|
32 |
||
33 |
||
34 |
def update_parser(parser): |
|
35 |
login = getlogin() |
|
36 |
parser.add_option('-r', '--rebuild-database', dest='rebuild_db', |
|
37 |
default=False, action="store_true", |
|
38 |
help="remove tmpdb and rebuilds the test database") |
|
39 |
parser.add_option('-u', '--dbuser', dest='dbuser', action='store', |
|
40 |
default=login, help="database user") |
|
41 |
parser.add_option('-w', '--dbpassword', dest='dbpassword', action='store', |
|
5165
e5efbcaa3011
fixed skeleton help strings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
4212
diff
changeset
|
42 |
default=login, help="database user's password") |
0 | 43 |
parser.add_option('-n', '--dbname', dest='dbname', action='store', |
44 |
default=None, help="database name") |
|
45 |
parser.add_option('--euser', dest='euser', action='store', |
|
5165
e5efbcaa3011
fixed skeleton help strings
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
4212
diff
changeset
|
46 |
default=login, help="euser name") |
0 | 47 |
parser.add_option('--epassword', dest='epassword', action='store', |
48 |
default=login, help="euser's password' name") |
|
49 |
return parser |
|
50 |
||
51 |
||
52 |
class CustomPyTester(PyTester): |
|
53 |
def __init__(self, cvg, options): |
|
54 |
super(CustomPyTester, self).__init__(cvg, options) |
|
55 |
if options.rebuild_db: |
|
56 |
os.unlink('tmpdb') |
|
57 |
os.unlink('tmpdb-template') |