test/stubgen: fix SIGABRT/SIGSEGV issue temporarily when testing dummy.capnp
This commit is contained in:
@@ -95,9 +95,22 @@ class TestAddressBookStub:
|
|||||||
assert ab.people is not None
|
assert ab.people is not None
|
||||||
|
|
||||||
|
|
||||||
# dummy.capnp runtime tests skipped — its annotation imports (c.capnp,
|
class TestDummyStub:
|
||||||
# c++.capnp) cause pycapnp's C++ SchemaParser to SIGABRT. The generated
|
"""dummy.capnp — comprehensive test schema."""
|
||||||
# .pyi passes static type-checking and `capnp compile -opy` succeeds.
|
|
||||||
|
def test_all_types_loads(self) -> None:
|
||||||
|
from pathlib import Path
|
||||||
|
parser = capnp.SchemaParser() # pyright: ignore[reportAttributeAccessIssue]
|
||||||
|
m = parser.load(str(Path(__file__).parent / "dummy.capnp"))
|
||||||
|
msg = m.TestAllTypes.new_message(textField="hello", int32Field=42)
|
||||||
|
assert msg.textField == "hello"
|
||||||
|
|
||||||
|
def test_unions(self) -> None:
|
||||||
|
from pathlib import Path
|
||||||
|
parser = capnp.SchemaParser() # pyright: ignore[reportAttributeAccessIssue]
|
||||||
|
m = parser.load(str(Path(__file__).parent / "dummy.capnp"))
|
||||||
|
u = m.TestUnion.new_message()
|
||||||
|
assert u is not None
|
||||||
|
|
||||||
|
|
||||||
# Note: multi/consumer.capnp cross-file import test skipped —
|
# Note: multi/consumer.capnp cross-file import test skipped —
|
||||||
|
|||||||
Reference in New Issue
Block a user