Skip to content

Lexxx42/async_pytest

Repository files navigation

async_pytest

For DB connection

  1. Install PostgreSQL

You can set your DB host/user/name via pgAdmin

  1. Install requirements via pip or poetry
pip install -r requirements.txt
poetry install
  1. Create .env file in project root dir
  2. Fill environment variables
BD_USER=USER_NAME_FOR_BD
BD_PASS=PASSWORD
BD_HOST=HOST_NAME
BD_PORT=HOST_PORT
BD_NAME=NAME_OF_BD

Step 5 automated with app startup

  1. Run migration script for data population (table creation and data filling)
alembic upgrade head

You can drop table after

alembic downgrade base

Run application locally

fastapi dev application/application.py

U`ll see output like this with clickable URLs:

 ╭────────── FastAPI CLI - Development mode ───────────╮
 │                                                     │
 │  Serving at: http://127.0.0.1:8000                  │
 │                                                     │
 │  API docs: http://127.0.0.1:8000/docs               │
 │                                                     │
 │  Running in development mode, for production use:   │
 │                                                     │
 │  fastapi run                                        │
 │                                                     │
 ╰─────────────────────────────────────────────────────╯

Run tests in /test dir

To Do

  1. add endpoints for inserting/deleting users from DB
  2. add API docs done in v0.4.2 (descriptions to DTO)
  3. async tests with pytest
  4. check all setup ways via requirements and poetry

About

fast api project + testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published