Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the baseline test new-year race condition. Fix #3723. #3724

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
tmp/
cache/
output/
baseline/
nikola-baseline-build/
/tags
v3.*.zip.*

# GitHub token
.pypt/gh-token
Expand Down
22 changes: 11 additions & 11 deletions nikola/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ def main(args=None):
else:
needs_config_file = False

invariant = False

if len(args) > 0 and args[0] == 'build' and '--invariant' in args:
try:
import freezegun
freeze = freezegun.freeze_time("2038-01-01")
freeze.start()
invariant = True
except ImportError:
req_missing(['freezegun'], 'perform invariant builds')

sys.path.insert(0, os.path.dirname(conf_filename))
try:
spec = importlib.util.spec_from_file_location("conf", conf_filename)
Expand All @@ -138,17 +149,6 @@ def main(args=None):
if conf_filename_changed:
LOGGER.info("Using config file '{0}'".format(conf_filename))

invariant = False

if len(args) > 0 and args[0] == 'build' and '--invariant' in args:
try:
import freezegun
freeze = freezegun.freeze_time("2038-01-01")
freeze.start()
invariant = True
except ImportError:
req_missing(['freezegun'], 'perform invariant builds')

if config:
if os.path.isdir('plugins') and not os.path.exists('plugins/__init__.py'):
with open('plugins/__init__.py', 'w') as fh:
Expand Down
6 changes: 4 additions & 2 deletions scripts/baseline.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

set -e -o pipefail -x

PYVER=$(scripts/getpyver.py short)
if [[ "$1" == "check" ]]; then
echo -e "\033[36m>> Downloading baseline for $PYVER...\033[0m"
Expand All @@ -19,8 +22,7 @@ rm "pages/creating-a-theme.rst" "pages/extending.rst" "pages/internals.rst" "pag
LC_ALL='en_US.UTF-8' PYTHONHASHSEED=0 nikola build --invariant
if [[ "$1" == "check" ]]; then
echo -e "\033[36m>> Testing baseline...\033[0m"
diff -ubwr ../baseline output
if [[ $? == 0 ]]; then
if diff -ubwr ../baseline output; then
echo -e "\033[32;1m>> Baseline test successful\033[0m"
else
CODE=$?
Expand Down
Loading