12 |
12 |
13 from logilab.common.debugger import Debugger |
13 from logilab.common.debugger import Debugger |
14 from logilab.common.testlib import InnerTest |
14 from logilab.common.testlib import InnerTest |
15 from logilab.common.pytest import nocoverage |
15 from logilab.common.pytest import nocoverage |
16 |
16 |
|
17 from cubicweb import ValidationError |
17 from cubicweb.devtools import VIEW_VALIDATORS |
18 from cubicweb.devtools import VIEW_VALIDATORS |
18 from cubicweb.devtools.apptest import EnvBasedTC |
19 from cubicweb.devtools.apptest import EnvBasedTC |
19 from cubicweb.devtools._apptest import unprotected_entities, SYSTEM_RELATIONS |
20 from cubicweb.devtools._apptest import unprotected_entities, SYSTEM_RELATIONS |
20 from cubicweb.devtools.htmlparser import DTDValidator, SaxOnlyValidator, HTMLValidator |
21 from cubicweb.devtools.htmlparser import DTDValidator, SaxOnlyValidator, HTMLValidator |
21 from cubicweb.devtools.fill import insert_entity_queries, make_relations_queries |
22 from cubicweb.devtools.fill import insert_entity_queries, make_relations_queries |
148 rset = cu.execute('DISTINCT Any X,Y WHERE X %s Y' % rschema) |
149 rset = cu.execute('DISTINCT Any X,Y WHERE X %s Y' % rschema) |
149 existingrels.setdefault(rschema.type, set()).update((x, y) for x, y in rset) |
150 existingrels.setdefault(rschema.type, set()).update((x, y) for x, y in rset) |
150 q = make_relations_queries(self.schema, edict, cu, ignored_relations, |
151 q = make_relations_queries(self.schema, edict, cu, ignored_relations, |
151 existingrels=existingrels) |
152 existingrels=existingrels) |
152 for rql, args in q: |
153 for rql, args in q: |
153 cu.execute(rql, args) |
154 try: |
|
155 cu.execute(rql, args) |
|
156 except ValidationError, ex: |
|
157 # failed to satisfy some constraint |
|
158 print 'error in automatic db population', ex |
154 self.post_populate(cu) |
159 self.post_populate(cu) |
155 self.commit() |
160 self.commit() |
156 |
161 |
157 @nocoverage |
162 @nocoverage |
158 def _check_html(self, output, view, template='main-template'): |
163 def _check_html(self, output, view, template='main-template'): |