mirror of
https://github.com/fergalmoran/picard.git
synced 2025-12-26 19:29:01 +00:00
Skip locale test if locales are not built, build locales in CI tests
This commit is contained in:
12
.github/workflows/run-tests.yml
vendored
12
.github/workflows/run-tests.yml
vendored
@@ -26,6 +26,17 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install --upgrade setuptools
|
||||
pip install -r requirements.txt
|
||||
- name: Install gettext (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install gettext
|
||||
- name: Install gettext (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install gettext
|
||||
brew link gettext --force
|
||||
echo "/usr/local/opt/gettext/bin" >> $GITHUB_PATH
|
||||
- name: Check coding style
|
||||
run: |
|
||||
pip install flake8 "isort>=5"
|
||||
@@ -35,6 +46,7 @@ jobs:
|
||||
if: always()
|
||||
timeout-minutes: 30
|
||||
run: |
|
||||
python setup.py build_locales -i
|
||||
pip install pytest pytest-randomly pytest-cov
|
||||
pytest --verbose --cov=picard --cov-report xml:coverage.xml test
|
||||
- name: Test python-libdiscid (Linux)
|
||||
|
||||
@@ -22,12 +22,16 @@
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from test.picardtestcase import PicardTestCase
|
||||
|
||||
from picard import i18n
|
||||
|
||||
|
||||
localedir = os.path.join(os.path.dirname(__file__), '..', 'locale')
|
||||
|
||||
|
||||
class TestI18n(PicardTestCase):
|
||||
|
||||
def test_missing_locales(self):
|
||||
@@ -48,8 +52,9 @@ class TestI18n(PicardTestCase):
|
||||
self.assertEqual('France', gettext_countries('France'))
|
||||
self.assertEqual('Cassette', pgettext_attributes('medium_format', 'Cassette'))
|
||||
|
||||
@unittest.skipUnless(os.path.exists(os.path.join(localedir, 'de')),
|
||||
'Test requires locales to be built with "python setup.py build_locales -i"')
|
||||
def test_existing_locales(self):
|
||||
localedir = os.path.join(os.path.dirname(__file__), '..', 'locale')
|
||||
locale_de = os.path.join(localedir, 'de', 'LC_MESSAGES', 'picard.mo')
|
||||
self.assertTrue(os.path.exists(locale_de), 'expected file %s' % locale_de)
|
||||
i18n.setup_gettext(localedir, 'de')
|
||||
|
||||
Reference in New Issue
Block a user