Skip to content
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

Merged
merged 8 commits into from
Mar 24, 2023
Merged

🏭 Factories #8

merged 8 commits into from
Mar 24, 2023

Conversation

afred
Copy link
Contributor

@afred afred commented Mar 23, 2023

Uses pydantic-factories package to add factories for generating test data for Chowda models.

Also:

  • Adds *.sqlite to gitignore.

Uses pydantic-factories package to add factories for generating test data for Chowda models.

Also:
* Adds *.sqlite to gitignore.
@mrharpo mrharpo marked this pull request as draft March 23, 2023 20:44
@mrharpo mrharpo changed the title Adds factories for test data 🏭 Factories Mar 23, 2023
@mrharpo mrharpo self-requested a review March 23, 2023 21:48
@mrharpo mrharpo added this to the v0.1.0 Demo 🏗️ milestone Mar 23, 2023
Copy link
Contributor

@mrharpo mrharpo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧑‍🏭 🔧 Very cool! 👍

async with AsyncSession(engine) as session:
for d in data:
session.add(d)
await session.commit()
Copy link
Contributor

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
Copy link
Contributor

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.

afred and others added 2 commits March 24, 2023 13:28
* 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
@mrharpo mrharpo temporarily deployed to Codecov March 24, 2023 17:45 — with GitHub Actions Inactive
@mrharpo mrharpo temporarily deployed to Codecov March 24, 2023 17:45 — with GitHub Actions Inactive
@mrharpo mrharpo marked this pull request as ready for review March 24, 2023 17:45
@mrharpo mrharpo temporarily deployed to Codecov March 24, 2023 17:46 — with GitHub Actions Inactive
@mrharpo mrharpo temporarily deployed to Codecov March 24, 2023 17:46 — with GitHub Actions Inactive
@mrharpo mrharpo temporarily deployed to Codecov March 24, 2023 17:50 — with GitHub Actions Inactive
@mrharpo mrharpo temporarily deployed to Codecov March 24, 2023 17:50 — with GitHub Actions Inactive
@mrharpo mrharpo merged commit a9f7785 into main Mar 24, 2023
@mrharpo mrharpo deleted the sample-data-factories branch March 24, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants