Repository navigation
Test the stated span with a key that covers now - #8
Merged
Merged
Conversation
The test that checks a recent minute is served from a span the creator stated read the clock, whilst the stand in end point it used answers for no moment after 14 September 2026. From 21 September 2026 the end point therefore answered with a key whose span did not hold the minutes asked about, each one was fetched, and the test failed with three requests where it expects one. The creator in the test now states one key for the day either side of now, as the .NET test does, so the test no longer depends on the dates in the fixture schedule and keeps checking after the last key in the fixture has started.
This was referenced Oct 5, 2026
jwrosewell
marked this pull request as ready for review
October 6, 2026 16:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
test_a_recent_minute_is_served_where_the_creator_stated_the_spanintests/test_public_key_fetch.pyfails onmainon any day from 21 September 2026. Run onmainat 80495f4 on 5 October 2026, the CI command gives the result below.The last CI run on
mainwas on 7 September 2026, before the date mattered, somainstill shows a green tick.Cause
The test reads the clock and asks for the key at three minutes near now. The stand in end point the test used fixes the moment of a request at 14 September 2026 and reads any later date as that moment (
REQUEST_MOMENTintests/key_end_point.py). Up to 20 September the answer was the key in force now, with a span that held all three minutes, so one request served them. From 21 September the answer is the key for the week of 14 September, whose span holds none of the minutes asked about, so each minute is fetched and the test counts three requests.Change
The creator in this test now states one key for the day either side of now. The test defines a small end point that answers every request with that one key, built with
endpoints.public_key_answer, in place of the fixture schedule. The three requests and the assertion are unchanged. The skip that depended on the fixture schedule is gone, so the test also keeps checking after 30 November 2026, when the last key in the fixture starts and the old test would have skipped.The old test also depended on the time of day. Replayed with the clock set to 00:05 on 14 September 2026, the old steps counted two requests, because in the first ten minutes of a key's week the minute ten minutes back belongs to the week before. The new steps counted one request at every moment tried.
The .NET library's test of the same behaviour is already written this way, as
ARecentMinuteIsServedWhereTheCreatorStatedTheSpaninOwid.Client.Test/PublicKeyFetchTests.cs, and the Rust library has the same change in SWAN-community/owid-rust#13.Only
tests/test_public_key_fetch.pychanges. No library code, helper or fixture changes.Verification
Run on Windows on 5 October 2026 with the two commands of the CI workflow.
pip install .succeeds.python -m unittest discoverruns 177 tests and passes on Python 3.14.7 and on Python 3.9.1, wheremaingives one failure. Python 3.12, which the CI uses, was not available locally._held_forinowid/public_key_fetch.pychanged fromkey.explicit or not recenttonot recent, the changed test fails with1 != 3, so the test still depends on the behaviour its name describes. That change was then put back.Outstanding
The same test in the Go, Java, PHP, Python and Rust libraries has the same cause, and failed in each when the one test was run on each
mainon 5 October 2026. The other four are changed in SWAN-community/owid-rust#13, SWAN-community/owid-go#19, SWAN-community/owid-java#10 and SWAN-community/owid-php#7.