Skip to content

Commit abc7ec4

Browse files
committed
Added README
1 parent 1fc0ef5 commit abc7ec4

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
# fastapi-testcontainer-async
1+
# Testcontainers with FastAPI and asyncpg
2+
3+
This repository is a simple example application of how to test asynchronous FastAPI routes using a Docker instance of PostgreSQL with `asyncpg` as the database driver. It is done by using [testcontainers-python](https://github.com/testcontainers/testcontainers-python).
4+
5+
You can check a more detailed text about the repository [here](https://lealre.github.io/fastapi-testcontainer-asyncpg/).
6+
7+
## How to run this project
8+
9+
This repo was created using [uv](https://docs.astral.sh/uv/) and uses Python version 3.12.3.
10+
11+
[How to install uv](https://docs.astral.sh/uv/getting-started/installation/).
12+
13+
1. Clone the repo locally and access the project folder:
14+
15+
```bash
16+
git clone https://github.com/lealre/fastapi-testcontainer-asyncpg.git
17+
cd fastapi-testcontainer-asyncpg
18+
```
19+
20+
2. Run the command to serve the API on port 8000. It will automatically create and activate the virtual environment:
21+
22+
```bash
23+
uv run -m fastapi dev src/app.py
24+
```
25+
26+
To test the endpoint, access `http://localhost:8000/docs`.
27+
28+
3. Run the tests:
29+
30+
```bash
31+
uv run pytest -vv
32+
```

0 commit comments

Comments
 (0)