Skip to content

Commit

Permalink
test: add i18n fixture for locale/language/gettext config
Browse files Browse the repository at this point in the history
  • Loading branch information
redshiftzero committed Apr 26, 2019
1 parent 8f64192 commit caeaba6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@


@pytest.fixture(scope='function')
def homedir():
def i18n():
'''
Set up locale/language/gettext functions. This enables the use of _().
'''
configure_locale_and_language()


@pytest.fixture(scope='function')
def homedir(i18n):
'''
Create a "homedir" for a client.
Expand All @@ -27,7 +35,6 @@ def homedir():
'''

tmpdir = tempfile.mkdtemp(prefix='sdc-')
configure_locale_and_language()
os.chmod(tmpdir, 0o0700)

data_dir = os.path.join(tmpdir, 'data')
Expand Down
4 changes: 2 additions & 2 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def test_SourceWidget_delete_source_when_user_chooses_cancel(mocker, session, so
sw.controller.delete_source.assert_not_called()


def test_LoginDialog_setup(mocker):
def test_LoginDialog_setup(mocker, i18n):
"""
The LoginView is correctly initialised.
"""
Expand Down Expand Up @@ -651,7 +651,7 @@ def test_LoginDialog_reset(mocker):
ld.error_label.setText.assert_called_once_with('')


def test_LoginDialog_error(mocker):
def test_LoginDialog_error(mocker, i18n):
"""
Any error message passed in is assigned as the text for the error label.
"""
Expand Down

0 comments on commit caeaba6

Please sign in to comment.