Summary
The Pagination._check root validator in tests/utils/schemas.py crashes with ZeroDivisionError whenever the API returns an empty paginated result set (maxPage=0, total=0, count=0).
The offending line:
per_page = total / max_page
max_page is 0 in this case, so the division fails before any of the assertions run.
Reproduction
Run test_job_searching_basic against a board that has no jobs (or any searching test where the result set is empty):
FAILED tests/test_job.py::test_job_searching_basic - ZeroDivisionError: division by zero
cls = <class 'tests.utils.schemas.Pagination'>
values = {'count': 0, 'facets': None, 'maxPage': 0, 'page': 1, ...}
> per_page = total / max_page
E ZeroDivisionError: division by zero
Scope
Pre-existing bug in the test-only validator (not in the production hrflow package). Not introduced by the pydantic v1→v2 migration — it would fail identically on v1.
Suggested fix
Short-circuit the pagination consistency checks when max_page == 0 (nothing to validate on an empty result set), or guard against the divide-by-zero directly.
Summary
The
Pagination._checkroot validator in tests/utils/schemas.py crashes withZeroDivisionErrorwhenever the API returns an empty paginated result set (maxPage=0,total=0,count=0).The offending line:
max_pageis0in this case, so the division fails before any of the assertions run.Reproduction
Run
test_job_searching_basicagainst a board that has no jobs (or any searching test where the result set is empty):Scope
Pre-existing bug in the test-only validator (not in the production
hrflowpackage). Not introduced by the pydantic v1→v2 migration — it would fail identically on v1.Suggested fix
Short-circuit the pagination consistency checks when
max_page == 0(nothing to validate on an empty result set), or guard against the divide-by-zero directly.