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
Copy file name to clipboardExpand all lines: .rules/new_models_best_practice.mdc
+109-1Lines changed: 109 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,10 +37,118 @@ Each example should contain the following files:
37
37
38
38
## 4. Testing
39
39
40
-
- Tests should be runnable with `pytest` directly from the repository root or inside the example’s Docker container.
40
+
- Tests should be runnable with `pytest` directly from the repository root or inside the example's Docker container.
41
41
- Mock Label Studio API interactions whenever possible to avoid requiring a running server during tests.
42
42
- Aim for good coverage of `fit()` and `predict()` logic to catch regressions.
43
43
44
+
### 4.1. Running Tests in Docker Containers
45
+
46
+
For ML backends that require specific dependencies or environments, Docker containers provide consistent testing environments. Here's the recommended workflow:
47
+
48
+
#### Setup and Build
49
+
```bash
50
+
# Navigate to your example directory
51
+
cd label_studio_ml/examples/<your_example>
52
+
53
+
# Build the Docker container (without --no-cache for faster builds)
54
+
docker compose -f docker-compose.yml build
55
+
56
+
# Start the container in background
57
+
docker compose -f docker-compose.yml up -d
58
+
```
59
+
60
+
#### Install Test Dependencies
61
+
Most containers won't have pytest installed by default. Install it:
0 commit comments