Skip to content

Commit

Permalink
add back path, remove other conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
gtfierro committed May 1, 2024
1 parent 89c5977 commit 065c457
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 68 deletions.
132 changes: 66 additions & 66 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,72 +28,72 @@ def pytest_generate_tests(metafunc):
shacl_engine = {"pyshacl", "topquadrant"}
metafunc.parametrize("shacl_engine", shacl_engine)

# validate 223P libraries and templates
libraries = ["libraries/ashrae/223p/nrel-templates"]

# skip these templates because they require additional context to be loaded,
# and are covered by other template tests
to_skip_223p = {
"nrel-templates": {
"sensor",
"differential-sensor",
"air-outlet-cp",
"air-inlet-cp",
"water-outlet-cp",
"water-inlet-cp",
"duct",
"junction",
}
}

if "library_path_223p" in metafunc.fixturenames:
metafunc.parametrize("library_path_223p", libraries)

if (
"library_path_223p" in metafunc.fixturenames
and "template_223p" in metafunc.fixturenames
):
bm = BuildingMOTIF("sqlite://")

templates = []
# load library
for library_path in libraries:
lib = Library.load(directory=library_path)
bm.session.commit()

for templ in lib.get_templates():
if templ.name in to_skip_223p[lib.name]:
continue
templates.append(templ.name)
bm.close()
BuildingMOTIF.clean()

metafunc.parametrize("template_223p", templates)

# validate Brick libraries and temmplates
brick_libraries = ["libraries/ashrae/guideline36"]
if "library_path_brick" in metafunc.fixturenames:
metafunc.parametrize("library_path_brick", brick_libraries)

if (
"library_path_brick" in metafunc.fixturenames
and "template_brick" in metafunc.fixturenames
):
bm = BuildingMOTIF("sqlite://")

Library.load(ontology_graph="libraries/brick/Brick-full.ttl")
templates = []
# load library
for library_path in brick_libraries:
lib = Library.load(directory=library_path)
bm.session.commit()

for templ in lib.get_templates():
templates.append(templ.name)
bm.close()
BuildingMOTIF.clean()

metafunc.parametrize("template_brick", templates)
## validate 223P libraries and templates
#libraries = ["libraries/ashrae/223p/nrel-templates"]

## skip these templates because they require additional context to be loaded,
## and are covered by other template tests
#to_skip_223p = {
# "nrel-templates": {
# "sensor",
# "differential-sensor",
# "air-outlet-cp",
# "air-inlet-cp",
# "water-outlet-cp",
# "water-inlet-cp",
# "duct",
# "junction",
# }
#}

#if "library_path_223p" in metafunc.fixturenames:
# metafunc.parametrize("library_path_223p", libraries)

#if (
# "library_path_223p" in metafunc.fixturenames
# and "template_223p" in metafunc.fixturenames
#):
# bm = BuildingMOTIF("sqlite://")

# templates = []
# # load library
# for library_path in libraries:
# lib = Library.load(directory=library_path)
# bm.session.commit()

# for templ in lib.get_templates():
# if templ.name in to_skip_223p[lib.name]:
# continue
# templates.append(templ.name)
# bm.close()
# BuildingMOTIF.clean()

# metafunc.parametrize("template_223p", templates)

## validate Brick libraries and temmplates
#brick_libraries = ["libraries/ashrae/guideline36"]
#if "library_path_brick" in metafunc.fixturenames:
# metafunc.parametrize("library_path_brick", brick_libraries)

#if (
# "library_path_brick" in metafunc.fixturenames
# and "template_brick" in metafunc.fixturenames
#):
# bm = BuildingMOTIF("sqlite://")

# Library.load(ontology_graph="libraries/brick/Brick-full.ttl")
# templates = []
# # load library
# for library_path in brick_libraries:
# lib = Library.load(directory=library_path)
# bm.session.commit()

# for templ in lib.get_templates():
# templates.append(templ.name)
# bm.close()
# BuildingMOTIF.clean()

# metafunc.parametrize("template_brick", templates)


@pytest.fixture
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_database_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
EXAMPLE_TRIPLE = (URIRef("http://example.org/alex"), RDF.type, FOAF.Person)


@pytest.mark.skip("This test is not working")
def test_database_persistence(tmp_path):
# create bm
path = tmp_path / "db.db"
print(path)
db_path = "sqlite://"
db_path = f"sqlite://{path}"
print(db_path)
bm = BuildingMOTIF(db_path)
print("setup tables")
Expand Down

0 comments on commit 065c457

Please sign in to comment.