From fa3235c5c29cf48c10632dc36992b489738a9b75 Mon Sep 17 00:00:00 2001 From: Manu <3916435+m3nu@users.noreply.github.com> Date: Sat, 30 May 2020 19:49:21 +0800 Subject: [PATCH] Fix English language UI for tests. Fixes #414 (#476) --- tests/conftest.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8022ed9e..1e0dcd6a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ import pytest import peewee import sys +import os from datetime import datetime as dt from unittest.mock import MagicMock @@ -41,8 +42,17 @@ def init_db(qapp): qapp.open_main_window_action() +@pytest.fixture(scope='session', autouse=True) +def local_en(): + """ + Some tests use English strings. So override whatever language the current user + has and run the tests with the English UI. + """ + os.environ['LANG'] = 'en_US' + + @pytest.fixture(scope='session') -def qapp(tmpdir_factory): +def qapp(tmpdir_factory, local_en): tmp_db = tmpdir_factory.mktemp('Vorta').join('settings.sqlite') mock_db = peewee.SqliteDatabase(str(tmp_db)) vorta.models.init_db(mock_db)