Replies: 1 comment 6 replies
-
I was tinkering with My initial idea is to make use of https://github.com/Goldziher/pydantic-factories to simplify my life a bit (I don' have to care about handling defaults or faking values). The usage would be simple, you just create a factory inheriting from You could even create a class CustomModelFactory(pydantic_factories.ModelFactory):
async def build(*args, **kwargs):
mock = super().build(*args, **kwargs)
await mock.save()
return mock then your mock would automatically get saved to the database. I will probably write something like this soon, as I'd need it too. |
Beta Was this translation helpful? Give feedback.
-
Just curious if anybody has used Ormar w/ factory-boy? I was trying to use factory-boy's
SQLAlchemyModelFactory
, and tweaking it so it would work, but Ii'm currently erroring out saying that my model is not mapped. I've tried connecting it to the metadata, but I keep getting told that the table is already defined. So I figure before I dive too deep into this, has anybody else tried to use factory-boy with Ormar?Beta Was this translation helpful? Give feedback.
All reactions