From aabcda94cf32562517bcdeade870b6ff0b8b8f7b Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sun, 23 Jul 2023 00:32:27 +0100 Subject: [PATCH] Add more information for the ``test_gettext_dont_rebuild_mo`` test (#11500) --- tests/test_intl.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/test_intl.py b/tests/test_intl.py index b34ce5e331..bcb602c819 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -620,10 +620,10 @@ def test_gettext_buildr_ignores_only_directive(app): @pytest.mark.sphinx(testroot='builder-gettext-dont-rebuild-mo') def test_gettext_dont_rebuild_mo(make_app, app_params): # --- don't rebuild by .mo mtime - def get_number_of_update_targets(app_): + def get_update_targets(app_): app_.env.find_files(app_.config, app_.builder) - _, updated, _ = app_.env.get_outdated_files(config_changed=False) - return len(updated) + added, changed, removed = app_.env.get_outdated_files(config_changed=False) + return added, changed, removed args, kwargs = app_params @@ -633,12 +633,14 @@ def test_gettext_dont_rebuild_mo(make_app, app_params): time.sleep(0.01) assert (app0.srcdir / 'xx' / 'LC_MESSAGES' / 'bom.mo').exists() # Since it is after the build, the number of documents to be updated is 0 - assert get_number_of_update_targets(app0) == 0 + update_targets = get_update_targets(app0) + assert update_targets[1] == set(), update_targets # When rewriting the timestamp of mo file, the number of documents to be # updated will be changed. mtime = (app0.srcdir / 'xx' / 'LC_MESSAGES' / 'bom.mo').stat().st_mtime (app0.srcdir / 'xx' / 'LC_MESSAGES' / 'bom.mo').utime((mtime + 5, mtime + 5)) - assert get_number_of_update_targets(app0) == 1 + update_targets = get_update_targets(app0) + assert update_targets[1] == {'bom'}, update_targets # Because doctree for gettext builder can not be shared with other builders, # erase doctreedir before gettext build. @@ -650,11 +652,13 @@ def test_gettext_dont_rebuild_mo(make_app, app_params): app.build() time.sleep(0.01) # Since it is after the build, the number of documents to be updated is 0 - assert get_number_of_update_targets(app) == 0 + update_targets = get_update_targets(app) + assert update_targets[1] == set(), update_targets # Even if the timestamp of the mo file is updated, the number of documents # to be updated is 0. gettext builder does not rebuild because of mo update. (app0.srcdir / 'xx' / 'LC_MESSAGES' / 'bom.mo').utime((mtime + 10, mtime + 10)) - assert get_number_of_update_targets(app) == 0 + update_targets = get_update_targets(app) + assert update_targets[1] == set(), update_targets @sphinx_intl