Skip to content

Commit cc499a3

Browse files
author
Daniel Gillet
committed
Remove Windows gettext binary installation
Update the unittest to be skipped in case the translation binaries were missing.
1 parent 97afe65 commit cc499a3

File tree

4 files changed

+12
-35
lines changed

4 files changed

+12
-35
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ jobs:
1313
matrix:
1414
python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"]
1515
os: [windows-latest, macos-latest, ubuntu-latest]
16-
include:
17-
- os: windows-latest
18-
translation-script: generate-translation-binaries.ps1
19-
- os: macos-latest
20-
translation-script: generate-translation-binaries.sh
21-
- os: ubuntu-latest
22-
translation-script: generate-translation-binaries.sh
2316

2417
steps:
2518
- uses: actions/checkout@v4
@@ -42,17 +35,12 @@ jobs:
4235
run: |
4336
brew install gettext
4437
45-
- name: Install Windows dependencies
46-
if: startsWith(matrix.os, 'windows')
47-
run: |
48-
scripts/install-gettext-windows.ps1
49-
5038
- name: Install uv
5139
uses: hynek/setup-cached-uv@v2
5240

5341
- name: Generate translation binaries
5442
run: |
55-
scripts/${{ matrix.translation-script }}
43+
scripts/generate-translation-binaries.sh
5644
5745
- name: Tox tests
5846
run: |

scripts/generate-translation-binaries.ps1

Lines changed: 0 additions & 6 deletions
This file was deleted.

scripts/install-gettext-windows.ps1

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/test_i18n.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,17 @@ def test_en_locale(self, NOW: dt.datetime) -> None:
228228
def test_None_locale(self, NOW: dt.datetime) -> None:
229229
three_seconds = NOW - dt.timedelta(seconds=3)
230230

231-
humanize.i18n.activate("fr")
232-
assert humanize.naturaltime(three_seconds) == "il y a 3 secondes"
231+
try:
232+
humanize.i18n.activate("fr")
233+
assert humanize.naturaltime(three_seconds) == "il y a 3 secondes"
233234

234-
humanize.i18n.activate(None)
235-
test_str = humanize.naturaltime(three_seconds)
236-
assert test_str == "3 seconds ago"
235+
humanize.i18n.activate(None)
236+
test_str = humanize.naturaltime(three_seconds)
237+
assert test_str == "3 seconds ago"
238+
except FileNotFoundError:
239+
pytest.skip("Generate .mo with scripts/generate-translation-binaries.sh")
240+
241+
finally:
242+
humanize.i18n.deactivate()
237243

238-
humanize.i18n.deactivate()
239244
assert test_str == humanize.naturaltime(three_seconds)

0 commit comments

Comments
 (0)