From f7f15be02d067ff421817ae194a287e8e12d5d9e Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sat, 5 Oct 2024 00:45:01 -0400 Subject: [PATCH] tests: skip if locale not available Signed-off-by: Henry Schreiner --- .github/workflows/ci.yml | 2 +- tests/test_translate.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e91a0e69..ce1c043e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: allow-prereleases: true - name: Add locale for locale test - if: runner.os == 'Linux' + if: runner.os == 'Linux' && matrix.python-version != '3.10' run: sudo locale-gen fr_FR.UTF-8 - name: Setup uv (cached) diff --git a/tests/test_translate.py b/tests/test_translate.py index 18541b71..305cba3a 100644 --- a/tests/test_translate.py +++ b/tests/test_translate.py @@ -23,6 +23,10 @@ def french(): locale.setlocale(locale.LC_ALL, "fr_FR.utf-8") reload_cli() yield + except locale.Error: + pytest.skip( + "No fr_FR locale found, run 'sudo locale-gen fr_FR.UTF-8' to run this test" + ) finally: locale.setlocale(locale.LC_ALL, "") reload_cli()