summaryrefslogtreecommitdiff
path: root/tests/test_catalogs.py
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2017-05-07 16:46:44 +0900
committershimizukawa <shimizukawa@gmail.com>2017-05-14 20:47:15 +0900
commitd497d743700704b10dc081c2a7d3508282155526 (patch)
tree34a509c10d38aff04d657a630582a880c5089aab /tests/test_catalogs.py
parent0512ebf2d45f5783755c3141754eac0f04755b9e (diff)
downloadsphinx-git-d497d743700704b10dc081c2a7d3508282155526.tar.gz
refs #3458: add sphinx.testing that are moved from /tests directory.
Diffstat (limited to 'tests/test_catalogs.py')
-rw-r--r--tests/test_catalogs.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/tests/test_catalogs.py b/tests/test_catalogs.py
index 64f2acb9a..b3e17a0a1 100644
--- a/tests/test_catalogs.py
+++ b/tests/test_catalogs.py
@@ -12,37 +12,36 @@ import shutil
import pytest
-from util import find_files, rootdir, tempdir
-
-root = tempdir / 'test-intl'
-build_dir = root / '_build'
-locale_dir = build_dir / 'locale'
+from sphinx.testing.util import find_files
@pytest.fixture
-def setup_test():
- # delete remnants left over after failed build
- root.rmtree(True)
- (rootdir / 'roots' / 'test-intl').copytree(root)
+def setup_test(app_params):
+ srcdir = app_params.kwargs['srcdir']
+ locale_dir = srcdir / 'locale'
# copy all catalogs into locale layout directory
- for po in find_files(root, '.po'):
+ for po in find_files(srcdir, '.po'):
copy_po = (locale_dir / 'en' / 'LC_MESSAGES' / po)
if not copy_po.parent.exists():
copy_po.parent.makedirs()
- shutil.copy(root / po, copy_po)
+ shutil.copy(srcdir / po, copy_po)
yield
- build_dir.rmtree(True)
+ # delete remnants left over after failed build
+ locale_dir.rmtree(True)
+ (srcdir / '_build').rmtree(True)
@pytest.mark.usefixtures('setup_test')
+@pytest.mark.test_params(shared_result='test-catalogs')
@pytest.mark.sphinx(
'html', testroot='intl',
- confoverrides={'language': 'en', 'locale_dirs': [locale_dir]})
+ confoverrides={'language': 'en', 'locale_dirs': ['./locale']})
def test_compile_all_catalogs(app, status, warning):
app.builder.compile_all_catalogs()
+ locale_dir = app.srcdir / 'locale'
catalog_dir = locale_dir / app.config.language / 'LC_MESSAGES'
expect = set([
x.replace('.po', '.mo')
@@ -54,10 +53,12 @@ def test_compile_all_catalogs(app, status, warning):
@pytest.mark.usefixtures('setup_test')
+@pytest.mark.test_params(shared_result='test-catalogs')
@pytest.mark.sphinx(
- 'html', testroot='intl',
- confoverrides={'language': 'en', 'locale_dirs': [locale_dir]})
+ 'html', testroot='intl',
+ confoverrides={'language': 'en', 'locale_dirs': ['./locale']})
def test_compile_specific_catalogs(app, status, warning):
+ locale_dir = app.srcdir / 'locale'
catalog_dir = locale_dir / app.config.language / 'LC_MESSAGES'
def get_actual():
@@ -70,12 +71,14 @@ def test_compile_specific_catalogs(app, status, warning):
@pytest.mark.usefixtures('setup_test')
+@pytest.mark.test_params(shared_result='test-catalogs')
@pytest.mark.sphinx(
- 'html', testroot='intl',
- confoverrides={'language': 'en', 'locale_dirs': [locale_dir]})
+ 'html', testroot='intl',
+ confoverrides={'language': 'en', 'locale_dirs': ['./locale']})
def test_compile_update_catalogs(app, status, warning):
app.builder.compile_update_catalogs()
+ locale_dir = app.srcdir / 'locale'
catalog_dir = locale_dir / app.config.language / 'LC_MESSAGES'
expect = set([
x.replace('.po', '.mo')