author | Philippe Pepiot <philippe.pepiot@logilab.fr> |
Tue, 25 Apr 2017 17:11:18 +0200 | |
changeset 12180 | 72a890b713c1 |
parent 11769 | f5b815f67ce2 |
child 12237 | 2dd0dcb2e5f9 |
permissions | -rw-r--r-- |
11767
432f87a63057
flake8 and all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11269
diff
changeset
|
1 |
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
4766
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:
1802
diff
changeset
|
18 |
|
11768
b8b71dd09a2c
[test] Avoid pytest discovery warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11767
diff
changeset
|
19 |
from cubicweb import devtools |
11250
597f02c5cf5a
[tox] Use py.test to run tests
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11237
diff
changeset
|
20 |
from cubicweb.devtools.repotest import BasePlannerTC, check_plan |
0 | 21 |
from cubicweb.server.ssplanner import SSPlanner |
22 |
||
11767
432f87a63057
flake8 and all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11269
diff
changeset
|
23 |
|
6781
5062d86d6ffe
[unittest2] use unittest2 module fixture api
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6632
diff
changeset
|
24 |
def setUpModule(*args): |
11767
432f87a63057
flake8 and all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11269
diff
changeset
|
25 |
# keep cnx so it's not garbage collected and the associated session closed |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
26 |
global repo, cnx |
11768
b8b71dd09a2c
[test] Avoid pytest discovery warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11767
diff
changeset
|
27 |
handler = devtools.get_test_db_handler(devtools.TestServerConfiguration('data', __file__)) |
7977
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
28 |
handler.build_db_cache() |
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
29 |
global repo, cnx |
e2d3ff3e7660
[test] drop some deprecation warnings
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
30 |
repo, cnx = handler.get_repo_and_cnx() |
0 | 31 |
|
11767
432f87a63057
flake8 and all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11269
diff
changeset
|
32 |
|
6781
5062d86d6ffe
[unittest2] use unittest2 module fixture api
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6632
diff
changeset
|
33 |
def tearDownModule(*args): |
4766
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
34 |
global repo, cnx |
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
35 |
del repo, cnx |
162b2b127b15
[test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
36 |
|
11767
432f87a63057
flake8 and all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11269
diff
changeset
|
37 |
|
0 | 38 |
class SSPlannerTC(BasePlannerTC): |
11250
597f02c5cf5a
[tox] Use py.test to run tests
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
11237
diff
changeset
|
39 |
_test = check_plan |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
40 |
|
0 | 41 |
def setUp(self): |
6631
26c303c3f1aa
[test] make test independant from the working directory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
42 |
self.__class__.repo = repo |
0 | 43 |
BasePlannerTC.setUp(self) |
3252
c0e10da6f1cf
tests update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2923
diff
changeset
|
44 |
self.planner = SSPlanner(self.o.schema, self.repo.vreg.rqlhelper) |
0 | 45 |
self.system = self.o._repo.system_source |
46 |
||
47 |
def tearDown(self): |
|
48 |
BasePlannerTC.tearDown(self) |
|
49 |
||
50 |
def test_ordered_ambigous_sol(self): |
|
3587 | 51 |
self._test('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket, State, Folder)', |
52 |
[('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN, X is IN(Basket, State, Folder)', |
|
0 | 53 |
[{'X': 'Basket', 'XN': 'String'}, |
3587 | 54 |
{'X': 'State', 'XN': 'String'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
55 |
{'X': 'Folder', 'XN': 'String'}])], |
11237
f32134dd0067
[repository] drop remanescence of old multi-sources code
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11057
diff
changeset
|
56 |
[])]) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
57 |
|
0 | 58 |
def test_groupeded_ambigous_sol(self): |
3587 | 59 |
self._test('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN (Basket, State, Folder)', |
60 |
[('OneFetchStep', [('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN(Basket, State, Folder)', |
|
0 | 61 |
[{'X': 'Basket', 'XN': 'String'}, |
3587 | 62 |
{'X': 'State', 'XN': 'String'}, |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
63 |
{'X': 'Folder', 'XN': 'String'}])], |
11237
f32134dd0067
[repository] drop remanescence of old multi-sources code
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11057
diff
changeset
|
64 |
[])]) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
65 |
|
0 | 66 |
if __name__ == '__main__': |
11769
f5b815f67ce2
[test] Remove some usages of lgc.testlib
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11768
diff
changeset
|
67 |
import unittest |
f5b815f67ce2
[test] Remove some usages of lgc.testlib
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11768
diff
changeset
|
68 |
unittest.main() |