mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Drop tests for deprecated modules
This commit is contained in:
parent
2adeb68af1
commit
9fe962c208
@ -1,4 +1,4 @@
|
|||||||
.. highlightlang:: c
|
.. highlight:: c
|
||||||
|
|
||||||
|
|
||||||
Memory
|
Memory
|
||||||
|
@ -56,117 +56,6 @@ def test_catalog_write_mo(tempdir):
|
|||||||
assert read_mo(f) is not None
|
assert read_mo(f) is not None
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_for_xx(tempdir):
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test2.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test3.pot').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test4.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test5.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / 'test6.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_ALL').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_ALL' / 'test7.po').write_text('#')
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', force_all=False)
|
|
||||||
domains = {c.domain for c in catalogs}
|
|
||||||
assert domains == {
|
|
||||||
'test1',
|
|
||||||
'test2',
|
|
||||||
'sub/test4',
|
|
||||||
'sub/test5',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_for_en(tempdir):
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'xx_dom.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / 'en_dom.po').write_text('#')
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'en', force_all=False)
|
|
||||||
domains = {c.domain for c in catalogs}
|
|
||||||
assert domains == {'en_dom'}
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_with_non_existent_locale(tempdir):
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx')
|
|
||||||
assert not catalogs
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], None)
|
|
||||||
assert not catalogs
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_with_non_existent_locale_dirs():
|
|
||||||
catalogs = i18n.find_catalog_source_files(['dummy'], 'xx')
|
|
||||||
assert not catalogs
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_for_xx_without_outdated(tempdir):
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.mo').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test2.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test2.mo').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test3.pot').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test3.mo').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test4.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test4.mo').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test5.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test5.mo').write_text('#')
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', force_all=False)
|
|
||||||
assert not catalogs
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', force_all=True)
|
|
||||||
domains = {c.domain for c in catalogs}
|
|
||||||
assert domains == {
|
|
||||||
'test1',
|
|
||||||
'test2',
|
|
||||||
'sub/test4',
|
|
||||||
'sub/test5',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_from_multiple_locale_dirs(tempdir):
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
|
|
||||||
(tempdir / 'loc2' / 'xx' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc2' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
|
|
||||||
(tempdir / 'loc2' / 'xx' / 'LC_MESSAGES' / 'test2.po').write_text('#')
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1', tempdir / 'loc2'], 'xx')
|
|
||||||
domains = sorted(c.domain for c in catalogs)
|
|
||||||
assert domains == ['test1', 'test1', 'test2']
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.filterwarnings('ignore:gettext_compact argument')
|
|
||||||
def test_get_catalogs_with_compact(tempdir):
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test1.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'test2.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test3.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test4.po').write_text('#')
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', gettext_compact=True)
|
|
||||||
domains = {c.domain for c in catalogs}
|
|
||||||
assert domains == {'test1', 'test2', 'sub/test3', 'sub/test4'}
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_catalogs_excluded(tempdir):
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / '.git').makedirs()
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / 'en_dom.po').write_text('#')
|
|
||||||
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / '.git' / 'no_no.po').write_text('#')
|
|
||||||
|
|
||||||
catalogs = i18n.find_catalog_source_files(
|
|
||||||
[tempdir / 'loc1'], 'en', force_all=False, excluded=lambda path: '.git' in path)
|
|
||||||
domains = {c.domain for c in catalogs}
|
|
||||||
assert domains == {'en_dom'}
|
|
||||||
|
|
||||||
|
|
||||||
def test_format_date():
|
def test_format_date():
|
||||||
date = datetime.date(2016, 2, 7)
|
date = datetime.date(2016, 2, 7)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user