Skip to content

Commit 25f2b01

Browse files
Locations V3: add import performance test
1 parent a7c6646 commit 25f2b01

4 files changed

Lines changed: 392 additions & 135 deletions

File tree

dojo/base_models/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Meta:
4242

4343
abstract = True
4444

45-
def save(self, *args: list, skip_validation: bool = not settings.V3_FEATURE_LOCATIONS, **kwargs: dict) -> None:
45+
def save(self, *args: list, skip_validation: bool | None = None, **kwargs: dict) -> None:
4646
"""
4747
Override save method to call the `full_clean()` validation function each save.
4848
@@ -53,6 +53,9 @@ def save(self, *args: list, skip_validation: bool = not settings.V3_FEATURE_LOCA
5353
- Validate the field uniqueness - `validate_unique()`
5454
All three steps are performed when you call a model's full_clean() method in the order above
5555
"""
56+
# make sure this is evaluated at runtime, not at class definition time which would be the case if we used it in the parameter default value
57+
if skip_validation is None:
58+
skip_validation = not settings.V3_FEATURE_LOCATIONS
5659
# Run the pre save logic, if enabled
5760
self.pre_save_logic()
5861
# Call the validations

readme-docs/CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ Please use [these test scripts](../tests) to test your changes. These are the sc
5555

5656
For changes that require additional settings, you can now use local_settings.py file. See the logging section below for more information.
5757

58+
## Updating Performance Test Query Counts
59+
60+
The importer performance tests in `unittests/test_importers_performance.py` assert on expected database query and async task counts. If your changes affect import behavior (e.g., adding queries or changing celery task usage), these counts may need to be updated.
61+
62+
Run the update script to refresh expected counts:
63+
64+
```bash
65+
python3 scripts/update_performance_test_counts.py
66+
```
67+
68+
The script runs both `TestDojoImporterPerformanceSmall` (v2 endpoints) and `TestDojoImporterPerformanceSmallLocations` (v3 locations), captures actual counts, and updates the test file when they differ from expectations.
69+
70+
To verify all tests pass after updating:
71+
72+
```bash
73+
python3 scripts/update_performance_test_counts.py --verify
74+
```
75+
5876
## Python3 Version
5977
For compatibility reasons, the code in dev branch should be python3.13 compliant.
6078

0 commit comments

Comments
 (0)