diff --git a/dump_updates/test/test_all.py b/dump_updates/test/test_all.py index 8e97d2a1cea461dc0f5613a5ea94eeac663d5b3c..acdeeeceb341c396c91b764e60bd8b30a7bcd19d 100644 --- a/dump_updates/test/test_all.py +++ b/dump_updates/test/test_all.py @@ -19,6 +19,11 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. """Testing the dump update scripts + +As a general rule, dump updaters should be idempotent, so tests should run the update again after +the first checks are successlful. + +TODO: Reduce the boilerplate for the tests. """ import filecmp @@ -68,3 +73,13 @@ def test_2024_10_02(tmpdir): check=True ) assert filecmp.cmp(output.name, expectedfile), "Output does not match expected output." + with (NamedTemporaryFile(dir=tmpdir, suffix=".sql", delete=True) as output2, + open(output.name, mode="rb") as infile_stream + ): + run([script_fullname], + stdin=infile_stream, + stdout=output2, + check=True + ) + assert filecmp.cmp(output2.name, expectedfile), ( + "Run 2: Output does not match expected output.")