Enhancement: Add --compare-json option to document_exporter to write json files only if changed (#8261)

This commit is contained in:
Kevin Doren
2024-11-19 07:20:24 -08:00
committed by GitHub
parent f0e71330ac
commit 827121808a
3 changed files with 63 additions and 20 deletions

View File

@@ -153,6 +153,7 @@ class TestExportImport(
*,
use_filename_format=False,
compare_checksums=False,
compare_json=False,
delete=False,
no_archive=False,
no_thumbnail=False,
@@ -165,6 +166,8 @@ class TestExportImport(
args += ["--use-filename-format"]
if compare_checksums:
args += ["--compare-checksums"]
if compare_json:
args += ["--compare-json"]
if delete:
args += ["--delete"]
if no_archive:
@@ -340,6 +343,10 @@ class TestExportImport(
self.assertNotEqual(st_mtime_1, st_mtime_2)
self.assertNotEqual(st_mtime_2, st_mtime_3)
self._do_export(compare_json=True)
st_mtime_4 = os.stat(os.path.join(self.target, "manifest.json")).st_mtime
self.assertEqual(st_mtime_3, st_mtime_4)
def test_update_export_changed_checksum(self):
shutil.rmtree(os.path.join(self.dirs.media_dir, "documents"))
shutil.copytree(