equal
deleted
inserted
replaced
14 import re |
14 import re |
15 from urllib import unquote |
15 from urllib import unquote |
16 from math import log |
16 from math import log |
17 from contextlib import contextmanager |
17 from contextlib import contextmanager |
18 from warnings import warn |
18 from warnings import warn |
19 |
|
20 try: |
|
21 import json |
|
22 except ImportError: |
|
23 import simplejson as json |
|
24 |
19 |
25 import yams.schema |
20 import yams.schema |
26 |
21 |
27 from logilab.common.testlib import TestCase, InnerTest |
22 from logilab.common.testlib import TestCase, InnerTest |
28 from logilab.common.pytest import nocoverage, pause_tracing, resume_tracing |
23 from logilab.common.pytest import nocoverage, pause_tracing, resume_tracing |
37 from cubicweb.sobjects import notification |
32 from cubicweb.sobjects import notification |
38 from cubicweb.web import Redirect, application |
33 from cubicweb.web import Redirect, application |
39 from cubicweb.server.session import security_enabled |
34 from cubicweb.server.session import security_enabled |
40 from cubicweb.devtools import SYSTEM_ENTITIES, SYSTEM_RELATIONS, VIEW_VALIDATORS |
35 from cubicweb.devtools import SYSTEM_ENTITIES, SYSTEM_RELATIONS, VIEW_VALIDATORS |
41 from cubicweb.devtools import fake, htmlparser |
36 from cubicweb.devtools import fake, htmlparser |
42 |
37 from cubicweb.utils import json |
43 |
38 |
44 # low-level utilities ########################################################## |
39 # low-level utilities ########################################################## |
45 |
40 |
46 class CubicWebDebugger(Debugger): |
41 class CubicWebDebugger(Debugger): |
47 """special debugger class providing a 'view' function which saves some |
42 """special debugger class providing a 'view' function which saves some |
261 self._init_repo() |
256 self._init_repo() |
262 except Exception, ex: |
257 except Exception, ex: |
263 self.__class__._repo_init_failed = ex |
258 self.__class__._repo_init_failed = ex |
264 raise |
259 raise |
265 resume_tracing() |
260 resume_tracing() |
|
261 self._cnxs = [] |
266 self.setup_database() |
262 self.setup_database() |
267 self.commit() |
263 self.commit() |
268 MAILBOX[:] = [] # reset mailbox |
264 MAILBOX[:] = [] # reset mailbox |
269 self._cnxs = [] |
|
270 |
265 |
271 def tearDown(self): |
266 def tearDown(self): |
272 for cnx in self._cnxs: |
267 for cnx in self._cnxs: |
273 if not cnx._closed: |
268 if not cnx._closed: |
274 cnx.close() |
269 cnx.close() |