diff --git a/tests/conftest.py b/tests/conftest.py index ebbc9e2c7f6..3934203eab3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,9 +5,23 @@ import pytest import sphinx +import sphinx.locale from sphinx.testing import comparer from sphinx.testing.path import path + +def _init_console(locale_dir=sphinx.locale._LOCALE_DIR, catalog='sphinx'): + """Monkeypatch ``init_console`` to skip its action. + + Some tests rely on warning messages in English. We don't want + CLI tests to bleed over those tests and make their warnings + translated. + """ + return sphinx.locale.NullTranslations(), False + + +sphinx.locale.init_console = _init_console + pytest_plugins = 'sphinx.testing.fixtures' # Exclude 'roots' dirs for pytest test collector