Skip to content

Commit

Permalink
All items
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jul 22, 2023
1 parent 3bf6e46 commit 075d76f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/test_intl.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ def test_gettext_dont_rebuild_mo(make_app, app_params):
# --- don't rebuild by .mo mtime
def get_update_targets(app_):
app_.env.find_files(app_.config, app_.builder)
_, updated, _ = app_.env.get_outdated_files(config_changed=False)
return updated
added, changed, removed = app_.env.get_outdated_files(config_changed=False)
return added, changed, removed

args, kwargs = app_params

Expand All @@ -633,12 +633,14 @@ def get_update_targets(app_):
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_update_targets(app0) == set()
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_update_targets(app0) == {'bom'}
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.
Expand All @@ -650,11 +652,13 @@ def get_update_targets(app_):
app.build()
time.sleep(0.01)
# Since it is after the build, the number of documents to be updated is 0
assert get_update_targets(app) == set()
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_update_targets(app) == set()
update_targets = get_update_targets(app)
assert update_targets[1] == set(), update_targets


@sphinx_intl
Expand Down

0 comments on commit 075d76f

Please sign in to comment.