Skip to content

Commit 1fc0ef5

Browse files
committed
docs: CI mkdocs material
1 parent f89e01d commit 1fc0ef5

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: ci
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: write
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Configure Git Credentials
14+
run: |
15+
git config user.name github-actions[bot]
16+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.x
20+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
21+
- uses: actions/cache@v4
22+
with:
23+
key: mkdocs-material-${{ env.cache_id }}
24+
path: .cache
25+
restore-keys: |
26+
mkdocs-material-
27+
- run: pip install mkdocs-material
28+
- run: mkdocs gh-deploy --force

docs/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def postgres_container(anyio_backend):
506506
yield postgres
507507
```
508508

509-
Now, every time we run the tests, we will have a similar workflow like the one below, where the `postgres_container` fixture will be created at the beginning of the test session, persist to be used in all the other fixtures, and be destroyed only when all the tests finish.
509+
Now, every time we run the tests, we will follow a workflow similar to the one below, where the `postgres_container` fixture is created only once at the beginning of the test session and is reused in all other fixtures. The `async_session` and `async_client` fixtures are still created and destroyed for each test. The `postgres_container` fixture is destroyed only after all the tests have finished.
510510

511511
```mermaid
512512
flowchart LR
@@ -559,7 +559,7 @@ flowchart LR
559559
class async_session_n,async_client_n,test_n fixtureStyle;
560560
```
561561

562-
Running the tests again, we should see that the time it took to run all the tests decreases to around 4 seconds, with a median of less than one second per test.
562+
Running the tests again, we should observe that the total time to run all tests decreases to around 4 seconds, with a median of less than one second per test.
563563

564564
```
565565
tests/test_routes.py::test_get_all_tickets_success PASSED [ 16%]
@@ -580,6 +580,8 @@ tests/test_routes.py::test_buy_ticket_when_already_sold PASSED [100%]
580580

581581
## Final version of test fixtures
582582

583+
The final `conftest.py` is presented below:
584+
583585
```py title="tests/conftest.py" linenums="1"
584586
import pytest
585587
from httpx import ASGITransport, AsyncClient

0 commit comments

Comments
 (0)