Repository navigation
fix test failures on Windows with a non-UTC timezone / MSYS2 bash - #10535
Merged
ThomasWaldmann merged 3 commits intoOct 18, 2026
Merged
Conversation
…rror On Windows, converting a naive timestamp shortly after the epoch to local time raises OSError (Errno 22) in timezones east of UTC, e.g. 1970-01-02T00:00:00 in CET, because CPython probes the local offset 24h earlier. borg recreate/create/prune --timestamp then crashed with a traceback. As ValueError, argparse reports it as an invalid timestamp value. test_recreate_with_given_timestamp now uses 1970-01-03T00:00:00, which converts fine on Windows east of UTC.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10535 +/- ##
==========================================
+ Coverage 89.32% 89.36% +0.04%
==========================================
Files 104 104
Lines 20079 20082 +3
Branches 3152 3152
==========================================
+ Hits 17936 17947 +11
+ Misses 1484 1478 -6
+ Partials 659 657 -2 ☔ View full report in Codecov by Harness. |
test_bash_repo_url_no_directories created directories like "rclone:" from Python, which is an invalid file name on Windows (WinError 123). Creating them from bash works everywhere: MSYS2/Cygwin map the colon to a valid file name character, so the test still checks the same thing on Windows. The test is skipped in CI because there is no bash >= 4 there, but runs on a dev box with MSYS2 bash 5.
ThomasWaldmann
force-pushed
the
fix-win-local-tests
branch
from
October 17, 2026 19:51
7206ff5 to
84ec928
Compare
Only needed for pip install --no-build-isolation, where pip does not install the build-system requirements from pyproject.toml. The script already installs the other ones via pacman, but setuptools-scm was missing, so packages built from sdist (e.g. borghash) got version 0.0.0 and dependency resolution failed. With build isolation (the default, also used by CI), pip installs setuptools-scm into the build environment anyway.
ThomasWaldmann
force-pushed
the
fix-win-local-tests
branch
from
October 17, 2026 19:55
84ec928 to
5a78cf4
Compare
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.
Running the test suite on Windows 11 (de-DE, CET, MSYS2 UCRT64, Python 3.14) gave 3 failures that CI (UTC, en-US, no bash >= 4) does not see:
recreate_cmd_test.py::test_recreate_with_given_timestamp(archiverandbinary_archiver):--timestamp 1970-01-02T00:00:00is converted to local time withdatetime.astimezone(). In timezones east of UTC, CPython probes the local offset 24h earlier, which is before the epoch, and Windows'localtime()raisesOSError: [Errno 22].parse_local_timestamplet that escape, so borg crashed with a traceback. In the binary variant, the test harness then also hit aUnicodeDecodeError, because the German Windows error text is cp1252, not UTF-8.parse_local_timestampnow turns thatOSErrorinto aValueError. For--timestamp(create, recreate, prune), argparse then reportsinvalid timestamp value: '1970-01-02T00:00:00'.completion_cmd_test.py::test_bash_repo_url_no_directories: created directories likessh:, which is an invalid file name on Windows (WinError 123). The test now creates them from bash instead: MSYS2/Cygwin map the colon to a valid file name character, so the test checks the same thing on Windows. CI skips this test (no bash >= 4), but it runs on a dev box with MSYS2 bash 5. The zsh/fish/tcsh siblings do not create directories.Also:
scripts/msys2-install-depsnow installspython-setuptools-scm. This is only needed forpip install --no-build-isolation, where pip does not install the build-system requirements frompyproject.toml. The script already installs the other ones via pacman. Without setuptools-scm, sdist dependencies such as borghash got built as version 0.0.0, and dependency resolution failed. With build isolation (the default, also used by CI), pip installs it into the build environment anyway.