Resolve _StrPath warnings in the tests

This commit is contained in:
Adam Turner 2024-11-02 21:39:18 +00:00
parent 9eff55711b
commit dedb21e638
2 changed files with 9 additions and 8 deletions

View File

@ -41,11 +41,12 @@ def test_config_status(make_app, app_params):
# incremental build (config entry changed)
app3 = make_app(*args, confoverrides={'root_doc': 'indexx'}, **kwargs)
fname = app3.srcdir / 'index.rst'
other_fname = app3.srcdir / 'indexx.rst'
assert fname.is_file()
shutil.move(fname, fname[:-4] + 'x.rst')
shutil.move(fname, other_fname)
assert app3.env.config_status == CONFIG_CHANGED
app3.build()
shutil.move(fname[:-4] + 'x.rst', fname)
shutil.move(other_fname, fname)
output = strip_colors(app3.status.getvalue())
assert 'The configuration has changed' in output
assert "[config changed ('master_doc')] 1 added," in output

View File

@ -19,16 +19,16 @@ def test_catalog_info_for_file_and_path():
cat = i18n.CatalogInfo('path', 'domain', 'utf-8')
assert cat.po_file == 'domain.po'
assert cat.mo_file == 'domain.mo'
assert cat.po_path == str(Path('path', 'domain.po'))
assert cat.mo_path == str(Path('path', 'domain.mo'))
assert cat.po_path == Path('path', 'domain.po')
assert cat.mo_path == Path('path', 'domain.mo')
def test_catalog_info_for_sub_domain_file_and_path():
cat = i18n.CatalogInfo('path', 'sub/domain', 'utf-8')
assert cat.po_file == 'sub/domain.po'
assert cat.mo_file == 'sub/domain.mo'
assert cat.po_path == str(Path('path', 'sub', 'domain.po'))
assert cat.mo_path == str(Path('path', 'sub', 'domain.mo'))
assert cat.po_path == Path('path', 'sub', 'domain.po')
assert cat.mo_path == Path('path', 'sub', 'domain.mo')
def test_catalog_outdated(tmp_path):
@ -178,8 +178,8 @@ def test_CatalogRepository(tmp_path):
# for language xx
repo = i18n.CatalogRepository(tmp_path, ['loc1', 'loc2'], 'xx', 'utf-8')
assert list(repo.locale_dirs) == [
str(tmp_path / 'loc1'),
str(tmp_path / 'loc2'),
tmp_path / 'loc1',
tmp_path / 'loc2',
]
assert all(isinstance(c, i18n.CatalogInfo) for c in repo.catalogs)
assert sorted(c.domain for c in repo.catalogs) == [