equal
deleted
inserted
replaced
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """unit tests for module cubicweb.schema""" |
18 """unit tests for module cubicweb.schema""" |
19 |
19 |
20 from os.path import join, dirname |
20 from os.path import join, dirname, splitext |
21 |
21 |
22 from logilab.common.testlib import TestCase, unittest_main |
22 from logilab.common.testlib import TestCase, unittest_main |
23 |
23 |
24 from rql import RQLSyntaxError |
24 from rql import RQLSyntaxError |
25 |
25 |
400 self.loader.defined = {} |
400 self.loader.defined = {} |
401 self.loader.loaded_files = [] |
401 self.loader.loaded_files = [] |
402 self.loader.post_build_callbacks = [] |
402 self.loader.post_build_callbacks = [] |
403 |
403 |
404 def _test(self, schemafile, msg): |
404 def _test(self, schemafile, msg): |
405 self.loader.handle_file(join(DATADIR, schemafile), None) |
405 self.loader.handle_file(join(DATADIR, schemafile), |
|
406 splitext(schemafile)[0]) |
406 sch = self.loader.schemacls('toto') |
407 sch = self.loader.schemacls('toto') |
407 with self.assertRaises(BadSchemaDefinition) as cm: |
408 with self.assertRaises(BadSchemaDefinition) as cm: |
408 fill_schema(sch, self.loader.defined, False) |
409 fill_schema(sch, self.loader.defined, False) |
409 self.assertEqual(str(cm.exception), msg) |
410 self.assertEqual(str(cm.exception), msg) |
410 |
411 |