Skip to content
Snippets Groups Projects
Commit 15b7ecf7 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

TST: allow tests to be called from src dir; import pytest

parent 6c1d336e
Branches
Tags
2 merge requests!57RELEASE 0.7.3,!52F refactor high level api
Pipeline #21941 passed with warnings
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
# A. Schlemmer, 02/2018 # A. Schlemmer, 02/2018
import pytest
import caosdb as db import caosdb as db
import caosdb.apiutils import caosdb.apiutils
from caosdb.apiutils import (apply_to_ids, compare_entities, create_id_query, from caosdb.apiutils import (apply_to_ids, compare_entities, create_id_query,
......
...@@ -26,10 +26,13 @@ ...@@ -26,10 +26,13 @@
import unittest import unittest
from lxml import etree from lxml import etree
import os
from caosdb import (INTEGER, Entity, Property, Record, RecordType, from caosdb import (INTEGER, Entity, Property, Record, RecordType,
configure_connection) configure_connection)
from caosdb.connection.mockup import MockUpServerConnection from caosdb.connection.mockup import MockUpServerConnection
UNITTESTDIR = os.path.dirname(os.path.abspath(__file__))
class TestEntity(unittest.TestCase): class TestEntity(unittest.TestCase):
...@@ -87,7 +90,7 @@ class TestEntity(unittest.TestCase): ...@@ -87,7 +90,7 @@ class TestEntity(unittest.TestCase):
""" """
parser = etree.XMLParser(remove_comments=True) parser = etree.XMLParser(remove_comments=True)
entity = Entity._from_xml(Entity(), entity = Entity._from_xml(Entity(),
etree.parse("unittests/test_record.xml", etree.parse(os.path.join(UNITTESTDIR, "test_record.xml"),
parser).getroot()) parser).getroot())
self.assertEqual(entity.role, "Record") self.assertEqual(entity.role, "Record")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment