source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/gluon/packages/dal/tests/_helpers.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 764 bytes
Line 
1from ._compat import unittest
2from ._adapt import DEFAULT_URI, drop
3from pydal import DAL
4
5
6class DALtest(unittest.TestCase):
7    def __init__(self, *args, **kwargs):
8        super(DALtest, self).__init__(*args, **kwargs)
9        self._connections = []
10
11    def connect(self, *args, **kwargs):
12        if not args:
13            kwargs.setdefault("uri", DEFAULT_URI)
14        kwargs.setdefault("check_reserved", ["all"])
15        ret = DAL(*args, **kwargs)
16        self._connections.append(ret)
17        return ret
18
19    def tearDown(self):
20        for db in self._connections:
21            db.commit()
22            tablist = list(db.tables)
23            for table in reversed(tablist):
24                drop(db[table])
25            db.close()
26        self._connections = []
Note: See TracBrowser for help on using the repository browser.