MCPcopy
hub / github.com/sphinx-doc/sphinx / _setup_test

Function _setup_test

tests/test_intl/test_catalogs.py:19–37  ·  view source on GitHub ↗
(app_params: _app_params)

Source from the content-addressed store, hash-verified

17
18@pytest.fixture
19def _setup_test(app_params: _app_params) -> Iterator[None]:
20 assert isinstance(app_params.kwargs['srcdir'], Path)
21 srcdir = app_params.kwargs['srcdir']
22 src_locale_dir = srcdir / 'xx' / 'LC_MESSAGES'
23 dest_locale_dir = srcdir / 'locale'
24 # copy all catalogs into locale layout directory
25 for po in src_locale_dir.rglob('*.po'):
26 copy_po = (
27 dest_locale_dir / 'en' / 'LC_MESSAGES' / po.relative_to(src_locale_dir)
28 )
29 if not copy_po.parent.exists():
30 copy_po.parent.mkdir(parents=True, exist_ok=True)
31 shutil.copy(po, copy_po)
32
33 yield
34
35 # delete remnants left over after failed build
36 shutil.rmtree(dest_locale_dir, ignore_errors=True)
37 shutil.rmtree(srcdir / '_build', ignore_errors=True)
38
39
40@pytest.mark.usefixtures('_setup_test')

Callers

nothing calls this directly

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…