You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Unit tests only (default - no API calls required)
71
+
uv run pytest -v
72
+
73
+
# Integration tests (requires API keys and quota)
74
+
uv run pytest -m integration
75
+
76
+
# All tests
77
+
uv run pytest -v --tb=short
78
+
```
79
+
80
+
6. **Run linting**:
81
+
```sh
82
+
uv run ruff check .
83
+
uv run ruff format .
84
+
```
85
+
86
+
>**Note**: Direct execution of `generate_quiz.py` requires valid API keys and quota. For development without making API calls, use the unit tests (`uv run pytest -v`) which use mocked responses.
87
+
88
+
### Using Docker
89
+
37
90
1. **Build the Docker container**:
38
91
```sh
39
92
docker build -t fastapi_generate_quiz:latest .
@@ -56,6 +109,8 @@ To debug locally, follow these steps:
4. **Tag the Docker image for GitHub Container Registry**:
60
115
```sh
61
116
docker tag fastapi_generate_quiz:latest ghcr.io/djsaunders1997/fastapi_generate_quiz:latest
@@ -78,27 +133,28 @@ Our test suite is divided into **unit tests** and **integration tests**.
78
133
79
134
### Default Behavior
80
135
81
-
By default, integration tests are **excluded** from the test run. This is achieved by configuring `pytest`in our `pytest.ini` file (located in the `backend` directory):
136
+
By default, integration tests are **excluded** from the test run. This is achieved by configuring `pytest`in our `pyproject.toml` file:
82
137
83
-
```ini
84
-
[pytest]
85
-
markers =
86
-
integration: mark test as an integration test.
87
-
addopts = -m "not integration"
138
+
```toml
139
+
[tool.pytest.ini_options]
140
+
markers = [
141
+
"integration: mark test as an integration test."
142
+
]
143
+
addopts = "-m 'not integration'"
88
144
```
89
145
90
146
This configuration tells `pytest` to skip any test marked with `@pytest.mark.integration` when you run:
91
147
92
148
```bash
93
-
pytest -v
149
+
uv run pytest -v
94
150
```
95
151
96
152
### Running Integration Tests
97
153
98
154
To run the integration tests, override the default marker filter by using the `-m` option:
99
155
100
156
```bash
101
-
pytest -m integration
157
+
uv run pytest -m integration
102
158
```
103
159
104
160
>**Note:** Integration tests make real API calls and require the `OPENAI_API_KEY` environment variable to be set. Make sure you have this environment variable configured before running these tests.
0 commit comments