Skip to content

Commit

Permalink
test: move mcmeta deletion to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BPR02 committed Dec 13, 2024
1 parent 70161ec commit 7f9bf67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 0 additions & 5 deletions beet_observer/data_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ def gen_dp_overlays(
continue
# check if it's the top-level overlay
if overlay == ctx.meta["observer"]["default_dir_dp"]:
# delete pack.mcmeta from overlay (required for tests)
default_dir = ctx.meta["observer"]["default_dir_dp"]
if ctx.data.overlays[default_dir].mcmeta:
del ctx.data.overlays[default_dir].mcmeta

# get pack format from build context
if "default_format" in ctx.meta["observer"]:
formats = ctx.meta["observer"]["default_format"]
Expand Down
5 changes: 0 additions & 5 deletions beet_observer/resource_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ def gen_rp_overlays(
continue
# check if it's the top-level overlay
if overlay == ctx.meta["observer"]["default_dir_rp"]:
# delete pack.mcmeta from overlay (required for tests)
default_dir = ctx.meta["observer"]["default_dir_rp"]
if ctx.assets.overlays[default_dir].mcmeta:
del ctx.assets.overlays[default_dir].mcmeta

# get pack format from build context
if "default_format" in ctx.meta["observer"]:
formats = ctx.meta["observer"]["default_format"]
Expand Down
6 changes: 6 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ def test_build(snapshot: SnapshotFixture, directory: str, tmp_path: Path):
) as ctx:
expected: Document = snapshot("pack.md")
actual = ctx.inject(Document)
for o in actual.data.overlays:
if actual.data.overlays[o].mcmeta:
del actual.data.overlays[o].mcmeta
for o in actual.assets.overlays:
if actual.assets.overlays[o].mcmeta:
del actual.assets.overlays[o].mcmeta
assert actual == expected

0 comments on commit 7f9bf67

Please sign in to comment.