From 4fb0323baf2d7312102e5014f54a9300f0247fe4 Mon Sep 17 00:00:00 2001 From: Sheng Yu Date: Thu, 14 Mar 2024 13:16:38 -0400 Subject: [PATCH] fix(test): use prime dir in some tests --- tests/unit/services/test_package.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/unit/services/test_package.py b/tests/unit/services/test_package.py index 52b56a68b0e..6feca6c9a1b 100644 --- a/tests/unit/services/test_package.py +++ b/tests/unit/services/test_package.py @@ -123,9 +123,11 @@ def test_write_metadata( build_plan=default_build_plan, ) - package_service.write_metadata(new_dir) + prime_dir = new_dir / "prime" + + package_service.write_metadata(prime_dir) - meta_dir = new_dir / "meta" + meta_dir = prime_dir / "meta" assert (meta_dir / "snap.yaml").read_text() == dedent( """\ name: default @@ -144,7 +146,7 @@ def test_write_metadata( """ ) - assert not (new_dir / "snap" / "manifest.yaml").exists() + assert not (prime_dir / "snap" / "manifest.yaml").exists() def test_write_metadata_with_manifest( @@ -162,13 +164,15 @@ def test_write_metadata_with_manifest( build_plan=default_build_plan, ) - package_service.write_metadata(new_dir) + prime_dir = new_dir / "prime" + + package_service.write_metadata(prime_dir) - snap_yaml = yaml.safe_load((new_dir / "meta" / "snap.yaml").read_text()) + snap_yaml = yaml.safe_load((prime_dir / "meta" / "snap.yaml").read_text()) # This will be different every time due to started_at differing, we can check # that it's a valid manifest and compare some fields to snap.yaml. - manifest_dict = yaml.safe_load((new_dir / "snap" / "manifest.yaml").read_text()) + manifest_dict = yaml.safe_load((prime_dir / "snap" / "manifest.yaml").read_text()) manifest = models.Manifest.parse_obj(manifest_dict) assert manifest.snapcraft_version == __version__