From a740d6fdc7a1c32050c443fee9f1857577f3b030 Mon Sep 17 00:00:00 2001 From: Kristjan Eimre Date: Wed, 24 Jan 2024 14:50:26 +0200 Subject: [PATCH] Update tests/storage/psql_dos/test_backend.py Co-authored-by: Sebastiaan Huber --- tests/storage/psql_dos/test_backend.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/tests/storage/psql_dos/test_backend.py b/tests/storage/psql_dos/test_backend.py index 7cadacbc49..a8d260dc3b 100644 --- a/tests/storage/psql_dos/test_backend.py +++ b/tests/storage/psql_dos/test_backend.py @@ -153,24 +153,18 @@ def test_unload_profile(): manager.load_profile(profile_name) -def test_backup(): +def test_backup(tmp_path): """Test that the backup function creates all the necessary files and folders""" - - import tempfile - from pathlib import Path - storage_backend = get_manager().get_profile_storage() - with tempfile.TemporaryDirectory() as tmpdir: - # note: this assumes that rsync and pg_dump are in PATH - storage_backend.backup(tmpdir) + # note: this assumes that rsync and pg_dump are in PATH + storage_backend.backup(str(tmp_path)) - last_backup = Path(tmpdir) / 'last-backup' - assert last_backup.is_symlink() + last_backup = tmp_path / 'last-backup' + assert last_backup.is_symlink() - # make sure the necessary files are there - # note: disk-objectstore container backup is already - # tested in its own repo - contents = [c.name for c in last_backup.iterdir()] - for name in ['config.json', 'container', 'db.psql']: - assert name in contents + # make sure the necessary files are there + # note: disk-objectstore container backup is already tested in its own repo + contents = [c.name for c in last_backup.iterdir()] + for name in ['config.json', 'container', 'db.psql']: + assert name in contents