-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🏭 Factories #8
🏭 Factories #8
Conversation
Uses pydantic-factories package to add factories for generating test data for Chowda models. Also: * Adds *.sqlite to gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧑🏭 🔧 Very cool! 👍
chowda/factories.py
Outdated
async with AsyncSession(engine) as session: | ||
for d in data: | ||
session.add(d) | ||
await session.commit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shamelessly copied from fastapi/sqlmodel#161 (comment)
Unfortunately, running it gives me:
sqlalchemy.exc.InvalidRequestError: The asyncio extension requires an async driver to be used. The loaded 'pysqlite' is not async.
But I think that's enough proof it works, so we should include it and we'll test it when we swap out for an async driver.
chowda/db.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even creating the async engine throws the same sqlalchemy.exc.InvalidRequestError
, hence the protection.
* main: Basic load testing with locust Basic docs structure Adds launch.json config for tests Adds stinkin' badges Adds sugar, xdist to pytest Adds first test! Adds flake8 and codecov defaults Remove environment, use new default Add version tags for workflows Adds CI tests and badges
Uses pydantic-factories package to add factories for generating test data for Chowda models.
Also: