test/unittest_spa2rql.py
changeset 10452 f3dec653a27d
parent 6340 470d8e828fda
equal deleted inserted replaced
10451:cffe653f93a9 10452:f3dec653a27d
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    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 import unittest
       
    19 
    18 from logilab.common.testlib import TestCase, unittest_main
    20 from logilab.common.testlib import TestCase, unittest_main
    19 from cubicweb.devtools import TestServerConfiguration
    21 from cubicweb.devtools import TestServerConfiguration
    20 from cubicweb.xy import xy
    22 from cubicweb.xy import xy
    21 from cubicweb.spa2rql import Sparql2rqlTranslator
    23 
       
    24 SKIPCAUSE = None
       
    25 try:
       
    26     from cubicweb.spa2rql import Sparql2rqlTranslator
       
    27 except ImportError as exc:
       
    28     SKIPCAUSE = str(exc)
    22 
    29 
    23 xy.add_equivalence('Project', 'doap:Project')
    30 xy.add_equivalence('Project', 'doap:Project')
    24 xy.add_equivalence('Project creation_date', 'doap:Project doap:created')
    31 xy.add_equivalence('Project creation_date', 'doap:Project doap:created')
    25 xy.add_equivalence('Project name', 'doap:Project doap:name')
    32 xy.add_equivalence('Project name', 'doap:Project doap:name')
    26 xy.add_equivalence('Project name', 'doap:Project dc:title')
    33 xy.add_equivalence('Project name', 'doap:Project dc:title')
    29 config = TestServerConfiguration('data')
    36 config = TestServerConfiguration('data')
    30 config.bootstrap_cubes()
    37 config.bootstrap_cubes()
    31 schema = config.load_schema()
    38 schema = config.load_schema()
    32 
    39 
    33 
    40 
       
    41 @unittest.skipIf(SKIPCAUSE, SKIPCAUSE)
    34 class XYTC(TestCase):
    42 class XYTC(TestCase):
    35     def setUp(self):
    43     def setUp(self):
    36         self.tr = Sparql2rqlTranslator(schema)
    44         self.tr = Sparql2rqlTranslator(schema)
    37 
    45 
    38     def _test(self, sparql, rql, args={}):
    46     def _test(self, sparql, rql, args={}):