Remove new-year race condition from "baseline testing". #3723
Description
Requested Feature: (short description)
The baseline tests make innocent pull requests fail early each year. Kindly fix the race condition.
Related Area: (eg. tasks, compilers, configuration, templates…)
Tests.
Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)
- [✔] Yes, I have already written code for it. See Remove the baseline test new-year race condition. Fix #3723. #3724 .
- Yes, I don’t have code ready yet (that’s okay!)
- No (that’s okay too!)
Does this feature affect backwards compatibility? If yes, in what way?
No, it does not. This concerns only tests.
Rationale and full description: (why should it be added to Nikola?)
There is a race condition. The precise circumstances to trigger the race condition are believed to be:
- The pull request is entered early in the year.
- The repo maintainers have not yet adjusted the baseline test to the new year.
You can see that race condition at work in one early-2024 test run, wrongly blaming pull request #3722.
This is not super-critical, as the baseline test is not required of a pull request.
Implementation idea
Integrate a filter that automatically adjusts the year number at that precise place where the diff (wrongly) finds it.
Prospect: More stabilization. (Not necessarily part of this feature request.)
Nikola is a Python project. The test could be ported from shell to Python. subprocess.run is our friend.
It is notoriously difficult to get shell script error handling correct. The baseline test is no exception. E.g., when run from another working directory different from what was intended, the scripts/getpyver.py
already fails, but the script continues undeterred as if nothing was wrong. The filtering could be done as part of a port of the script to Python.