(cls)
| 58 | @testing.fixture(scope="class") |
| 59 | @classmethod |
| 60 | def mapping_fixture(cls): |
| 61 | # note in order to work nicely with "fixture" we are emerging |
| 62 | # a whole new model of setup/teardown, since pytest "fixture" |
| 63 | # sort of purposely works badly with setup/teardown |
| 64 | |
| 65 | registry = sqlalchemy.orm.registry() |
| 66 | |
| 67 | metadata = MetaData() |
| 68 | parent = Table( |
| 69 | "parent", |
| 70 | metadata, |
| 71 | Column("id", Integer, primary_key=True), |
| 72 | Column("data", String(20)), |
| 73 | ) |
| 74 | child = Table( |
| 75 | "child", |
| 76 | metadata, |
| 77 | Column("id", Integer, primary_key=True), |
| 78 | Column("data", String(20)), |
| 79 | Column( |
| 80 | "parent_id", Integer, ForeignKey("parent.id"), nullable=False |
| 81 | ), |
| 82 | ) |
| 83 | |
| 84 | class Parent(testing.entities.BasicEntity): |
| 85 | pass |
| 86 | |
| 87 | class Child(testing.entities.BasicEntity): |
| 88 | pass |
| 89 | |
| 90 | registry.map_imperatively( |
| 91 | Parent, |
| 92 | parent, |
| 93 | properties={"children": relationship(Child, backref="parent")}, |
| 94 | ) |
| 95 | registry.map_imperatively(Child, child) |
| 96 | |
| 97 | registry.configure() |
| 98 | |
| 99 | yield Parent, Child |
| 100 | |
| 101 | registry.dispose() |
| 102 | |
| 103 | @testing.fixture(scope="function") |
| 104 | def stmt_fixture_one(self, mapping_fixture): |
nothing calls this directly
no test coverage detected