omniflo unittest liest aktuell nur die json Exports von Bricscad
This commit is contained in:
+20
-17
@@ -32,8 +32,18 @@ def _reference_dir():
|
||||
|
||||
|
||||
def _load_json(path):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
"""Laedt JSON, tolerant gegenueber BricsCAD-Ausgaben.
|
||||
|
||||
AutoLISP schreibt Dateien (write-line) im ANSI-Codepage des Systems,
|
||||
nicht in UTF-8 - Sonderzeichen (z.B. Grad-Zeichen in Beschreibungen)
|
||||
koennen daher nicht als UTF-8 dekodierbar sein. Fallback auf cp1252.
|
||||
"""
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except UnicodeDecodeError:
|
||||
with open(path, "r", encoding="cp1252") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
# --- Foerderer Fixtures ---
|
||||
@@ -68,22 +78,15 @@ def omniflo_testdata():
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def omniflo_csv():
|
||||
"""Laedt den Inhalt der omniflo_export.csv aus output/."""
|
||||
import csv as _csv
|
||||
path = os.path.join(_output_dir(), "omniflo_export.csv")
|
||||
def omniflo_results():
|
||||
"""Laedt die Omniflo-Ergebnisse aus output/omniflo_results.json."""
|
||||
path = os.path.join(_output_dir(), "omniflo_results.json")
|
||||
if not os.path.exists(path):
|
||||
pytest.skip(
|
||||
"omniflo_export.csv nicht vorhanden - "
|
||||
"TEST_OMNIFLO_EXPORT in BricsCAD ausfuehren"
|
||||
)
|
||||
rows = []
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
reader = _csv.reader(f, delimiter=";")
|
||||
header = next(reader)
|
||||
for row in reader:
|
||||
rows.append(row)
|
||||
return {"header": header, "rows": rows}
|
||||
pytest.skip("omniflo_results.json nicht vorhanden - TEST_OMNIFLO in BricsCAD ausfuehren")
|
||||
data = _load_json(path)
|
||||
if not data:
|
||||
pytest.skip("omniflo_results.json ist leer")
|
||||
return data
|
||||
|
||||
|
||||
# --- Kreisel Fixtures ---
|
||||
|
||||
Reference in New Issue
Block a user