Fix English language UI for tests. Fixes #414 (#476)

This commit is contained in:
Manu 2020-05-30 19:49:21 +08:00 committed by GitHub
parent edaed7b1cc
commit fa3235c5c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import pytest import pytest
import peewee import peewee
import sys import sys
import os
from datetime import datetime as dt from datetime import datetime as dt
from unittest.mock import MagicMock from unittest.mock import MagicMock
@ -41,8 +42,17 @@ def init_db(qapp):
qapp.open_main_window_action() 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') @pytest.fixture(scope='session')
def qapp(tmpdir_factory): def qapp(tmpdir_factory, local_en):
tmp_db = tmpdir_factory.mktemp('Vorta').join('settings.sqlite') tmp_db = tmpdir_factory.mktemp('Vorta').join('settings.sqlite')
mock_db = peewee.SqliteDatabase(str(tmp_db)) mock_db = peewee.SqliteDatabase(str(tmp_db))
vorta.models.init_db(mock_db) vorta.models.init_db(mock_db)