mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
test_sql - use Ifc2Sql patcher for readability
This commit is contained in:
@@ -20,6 +20,7 @@ import tempfile
|
||||
import ifcpatch
|
||||
import ifcopenshell
|
||||
from pathlib import Path
|
||||
from ifcpatch.recipes import Ifc2Sql
|
||||
|
||||
TEST_FILE = Path(__file__).parent / "files" / "basic.ifc"
|
||||
SQLITE_PATH = None
|
||||
@@ -29,13 +30,10 @@ def get_ifc_sqlite() -> ifcopenshell.sqlite:
|
||||
global SQLITE_PATH
|
||||
if SQLITE_PATH is None:
|
||||
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".ifcsqlite")
|
||||
ifcpatch.execute(
|
||||
{
|
||||
"file": ifcopenshell.open(TEST_FILE),
|
||||
"recipe": "Ifc2Sql",
|
||||
"arguments": ["sqlite", None, None, None, tmp.name],
|
||||
}
|
||||
)
|
||||
ifc_file = ifcopenshell.open(TEST_FILE)
|
||||
assert isinstance(ifc_file, ifcopenshell.file)
|
||||
patcher = Ifc2Sql.Patcher(ifc_file, database=tmp.name)
|
||||
patcher.patch()
|
||||
SQLITE_PATH = tmp.name
|
||||
ifc_sqlite = ifcopenshell.open(SQLITE_PATH)
|
||||
assert isinstance(ifc_sqlite, ifcopenshell.sqlite)
|
||||
|
||||
Reference in New Issue
Block a user