fix(core): preserve adapter command contracts
This commit is contained in:
@@ -4,6 +4,8 @@ from typer.testing import CliRunner
|
||||
|
||||
from tht.cli import app
|
||||
from tht.mschema.models import ColumnPhysical, PhysicalSchema, TablePhysical
|
||||
from tht.config import ExamplesConfig
|
||||
from tht.cli.schema_cmd import _add_examples
|
||||
|
||||
|
||||
def _write_catalog(tmp_path):
|
||||
@@ -68,3 +70,23 @@ def test_render_without_catalog_guides_fallback(tmp_path):
|
||||
res = CliRunner().invoke(app, ["schema", "render", "-c", str(cfg)])
|
||||
assert res.exit_code == 1
|
||||
assert "Esegui prima" in res.output
|
||||
|
||||
|
||||
def test_examples_skip_one_unreadable_column_and_continue(caplog):
|
||||
physical = PhysicalSchema(
|
||||
database="d", schema="s", introspected_at=datetime(2026, 1, 1),
|
||||
tables={"t": TablePhysical(columns={
|
||||
"bad": ColumnPhysical(type="text"), "good": ColumnPhysical(type="text")
|
||||
})},
|
||||
)
|
||||
|
||||
class Dwh:
|
||||
def sample_column(self, table, column, *, limit):
|
||||
if column == "bad":
|
||||
raise RuntimeError("denied")
|
||||
return ["kept"]
|
||||
|
||||
_add_examples(Dwh(), physical, ExamplesConfig(max_per_column=3))
|
||||
assert physical.tables["t"].columns["bad"].examples == []
|
||||
assert physical.tables["t"].columns["good"].examples == ["kept"]
|
||||
assert "Campionamento saltato" in caplog.text
|
||||
|
||||
Reference in New Issue
Block a user