Files
werkator/docs/prs/2026-10-10-PR#144-tests-in-one-locale.md
claude-code 4026d3725d
werkator build succeeded after 02:47
werkator/deploy build succeeded after 00:15
werkator/mutation build succeeded after 37:28
Tests in one locale (v1.38.15) (#144)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-10 13:48:32 +02:00

1.4 KiB

PR#144: Tests in One Locale

WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR-documentation is not maintained along with new PRs — treat it as a snapshot, not as current documentation.

The Problem

The tests ran in whatever locale the host had, and so did the processes they start, bash and git among them. On a host with a German LC_NUMERIC, bash writes EPOCHREALTIME as 1791625756,465101; $((…)) reads the comma as its comma operator. That made a test of PR#143 fail locally, while it would have passed on another host.

Non-Goals

  • No change to the locale of Werkator itself or of the builds it runs.

The Scenarios

Scenario#144.01: Tests run in the US English locale

  • Given a host with another locale, e.g. a German LC_NUMERIC
  • When a test runs, under Gradle or under PIT
  • Then the test and the processes it starts use en_US.UTF-8
  • So that a test that formats or parses numbers, dates or messages behaves the same on every host.
Verified by

The Solution

  • Every Test task sets LANG and LC_ALL to en_US.UTF-8, and user.language and user.country to en and US.
  • The pitest task sets the same environment for its main process; PIT's test processes inherit it.