Commit 0467c66d authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[test] Drop no more used "maxeid" based deletion in BaseQuerierTC and derived tests

This is probably only necessary for QuerierTC itself, move it there and drop
incantation from other derived classes to deactivate this feature.
parent 75a6b2f40c44
......@@ -142,22 +142,11 @@ class BaseQuerierTC(BaseTestCase):
self.ueid = self.admin_access._user.eid
assert self.ueid != -1
self.repo._type_cache = {} # clear cache
self.maxeid = self.get_max_eid()
do_monkey_patch()
self._dumb_sessions = []
def get_max_eid(self):
with self.admin_access.cnx() as cnx:
return cnx.execute('Any MAX(X)')[0][0]
def cleanup(self):
with self.admin_access.cnx() as cnx:
cnx.execute('DELETE Any X WHERE X eid > %s' % self.maxeid)
cnx.commit()
def tearDown(self):
undo_monkey_patch()
self.cleanup()
assert self.admin_access._user.eid != -1
def set_debug(self, debug):
......
# copyright 2003-2017 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -728,9 +728,6 @@ class MigrationCommandsTC(MigrationTC):
finally:
mh.cmd_add_cube('fakeemail')
self.assertIn('fakeemail', self.config.cubes())
# trick: overwrite self.maxeid to avoid deletion of just reintroduced
# types (and their associated tables!)
self.maxeid = cnx.execute('Any MAX(X)')[0][0] # XXXXXXX KILL KENNY
# why this commit is necessary is unclear to me (though without it
# next test may fail complaining of missing tables
cnx.commit()
......
# -*- coding: iso-8859-1 -*-
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -112,13 +112,6 @@ class UtilsTC(BaseQuerierTC):
setUpClass = classmethod(setUpClass)
tearDownClass = classmethod(tearDownClass)
def get_max_eid(self):
# no need for cleanup here
return None
def cleanup(self):
# no need for cleanup here
pass
def test_preprocess_1(self):
with self.admin_access.cnx() as cnx:
reid = cnx.execute('Any X WHERE X is CWRType, X name "owned_by"')[0][0]
......@@ -316,6 +309,17 @@ class QuerierTC(BaseQuerierTC):
setUpClass = classmethod(setUpClass)
tearDownClass = classmethod(tearDownClass)
def setUp(self):
super(QuerierTC, self).setUp()
with self.admin_access.cnx() as cnx:
self.maxeid = cnx.execute('Any MAX(X)')[0][0]
def tearDown(self):
super(QuerierTC, self).tearDown()
with self.admin_access.cnx() as cnx:
cnx.execute('DELETE Any X WHERE X eid > %s' % self.maxeid)
cnx.commit()
def test_unknown_eid(self):
# should return an empty result set
self.assertFalse(self.qexecute('Any X WHERE X eid 99999999'))
......
# -*- coding: iso-8859-1 -*-
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -31,14 +31,6 @@ class SQLGenAnnotatorTC(BaseQuerierTC):
self.__class__.repo = repo
super(SQLGenAnnotatorTC, self).setUp()
def get_max_eid(self):
# no need for cleanup here
return None
def cleanup(self):
# no need for cleanup here
pass
def test_0_1(self):
with self.admin_access.cnx() as cnx:
rqlst = self._prepare(cnx, 'Any SEN,RN,OEN WHERE X from_entity SE, '
......
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -44,9 +44,6 @@ class SSPlannerTC(BasePlannerTC):
self.planner = SSPlanner(self.o.schema, self.repo.vreg.rqlhelper)
self.system = self.o._repo.system_source
def tearDown(self):
BasePlannerTC.tearDown(self)
def test_ordered_ambigous_sol(self):
self._test('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket, State, Folder)',
[('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN, X is IN(Basket, State, Folder)',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment