da24f18888
With the verify extra installed, wrapped returns an OCP TopoDS_Shape of the class of its kind (as CadQuery's does), so the OCCT code an agent writes for verifier scripts runs as written. It is a copy made through BinTools; without OCP it stays the SDK's own OCCT shape, and SCA_WRAPPED=native|ocp chooses. The SDK's own layers take _native_wrapped, and the inspect.brep queries, the STEP export and the kernel geometry helpers accept either kind of shape. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
54 lines
2.4 KiB
Python
54 lines
2.4 KiB
Python
"""Shared test configuration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
# Failure-path evidence rendering stays off for the suite at large: it is
|
|
# slow (one render per failure) and exercises nothing those tests assert.
|
|
# Dedicated evidence tests opt back in via monkeypatch.delenv. Their
|
|
# per-render budget scales with the slowest runner (cold CI workers), not
|
|
# with the agent-facing default.
|
|
os.environ.setdefault("SCA_NO_DIAGNOSTIC_RENDER", "1")
|
|
os.environ.setdefault("SCA_DIAGNOSTIC_RENDER_BUDGET", "60")
|
|
|
|
# Worker processes for the notebooks a cell uses are for the tests that are
|
|
# about them (they set SCA_JOBS themselves): starting several interpreters per
|
|
# run would only slow the rest of the suite down.
|
|
os.environ.setdefault("SCA_JOBS", "1")
|
|
|
|
# ``shape.wrapped`` is an OCP shape when OCP is installed (the ``verify`` extra). Most of the suite hands it to the
|
|
# SDK's own OCCT classes (``simplecadapi._cpp.occt``), which want the native one, whether or not OCP happens to be in
|
|
# the environment: tests about the OCP view (test_wrapped_ocp.py) ask for it themselves.
|
|
os.environ.setdefault("SCA_WRAPPED", "native")
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# The C++ backend: failures that are known and classified.
|
|
#
|
|
# ``internal``: the test reads a private helper or an internal of the Python wrappers (the
|
|
# ``_TopoEntity`` cache, ``OperationNode`` dataclass pickling, ...) that the C++ port does not have;
|
|
# skipped. ``open``: a real parity difference of the native operators / recorder (most are the
|
|
# graph-replay contract of ``replay_model_json``: selection nodes, detail features, sketches); expected
|
|
# to fail, not strict, so a fix shows up as XPASS. src/cpp/docs/NATIVE_PROGRESS.md has the causes.
|
|
# ---------------------------------------------------------------------------
|
|
|
|
import json as _json
|
|
from pathlib import Path as _Path
|
|
|
|
import pytest as _pytest
|
|
|
|
_KNOWN = _json.loads((_Path(__file__).with_name("native_known_failures.json")).read_text(encoding="utf-8"))
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items): # noqa: D103
|
|
for item in items:
|
|
entry = _KNOWN.get(item.nodeid)
|
|
if entry is None:
|
|
continue
|
|
kind, reason = entry
|
|
if kind == "internal":
|
|
item.add_marker(_pytest.mark.skip(reason="native backend: " + reason))
|
|
else:
|
|
item.add_marker(_pytest.mark.xfail(reason="native backend: " + reason, strict=False))
|