https://github.com/ciur/microapp
https://github.com/ciur/microapp
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ciur/microapp
- Owner: ciur
- License: mit
- Created: 2024-10-28T15:04:54.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T06:20:51.000Z (11 months ago)
- Last Synced: 2025-04-11T04:12:36.289Z (6 months ago)
- Language: Python
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI + PyTest + SqlAlchemy + Postgresql/Sqlite
Minimal stucture of FastAPI app with pytest which features
SqlAlchemy over Postgresql.This small project illustrates how to use FastAPI + PyTest + SqlAlchemy +
Postgresql (and sqlite) + pydantic in one project.The point is to make pytest succeed regardless if database is Postgres or sqlite.
PostgreSql is trickier to deal with because of:
https://docs.sqlalchemy.org/en/20/faq/metadata_schema.html#my-program-is-hanging-when-i-say-table-drop-metadata-drop-all## Run test with Postgres
```
$ export PAPERMERGE__DATABASE__URL="postgresql://user:pass@localhost:5432
/test_microapp_db"
$ poetry run pytest
```# Run test with Sqlite
```
$ export PAPERMERGE__DATABASE__URL="sqlite:///test.sqlite3"
$ poetry run pytest
```