Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): use prime dir in some tests #4661

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions tests/unit/services/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ def test_write_metadata(
build_plan=default_build_plan,
)

package_service.write_metadata(new_dir)
prime_dir = new_dir / "prime"
meta_dir = prime_dir / "meta"

package_service.write_metadata(prime_dir)

meta_dir = new_dir / "meta"
assert (meta_dir / "snap.yaml").read_text() == dedent(
"""\
name: default
Expand All @@ -148,7 +150,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(
Expand All @@ -166,13 +168,16 @@ def test_write_metadata_with_manifest(
build_plan=default_build_plan,
)

package_service.write_metadata(new_dir)
prime_dir = new_dir / "prime"
syu-w marked this conversation as resolved.
Show resolved Hide resolved
meta_dir = prime_dir / "meta"

package_service.write_metadata(prime_dir)

snap_yaml = yaml.safe_load((new_dir / "meta" / "snap.yaml").read_text())
snap_yaml = yaml.safe_load((meta_dir / "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__
Expand Down
Loading