Skip to content

Commit

Permalink
(tests) checking out HL2 20th Anniversary maps
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Nov 17, 2024
1 parent ba6713e commit 2a26c19
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
3 changes: 0 additions & 3 deletions tests/archives/valve/test_Vpk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import fnmatch
import os

import pytest

from bsp_tool.archives import valve
Expand Down
28 changes: 28 additions & 0 deletions tests/valve/test_ValveBsp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import collections
import os

from bsp_tool.valve import ValveBsp
from bsp_tool.branches.strata import strata
from bsp_tool.branches.valve import orange_box
from bsp_tool.branches.valve import orange_box_x360
from bsp_tool.branches.valve import source

import pytest

Expand All @@ -16,6 +20,29 @@
strata: [
"Momentum Mod"]})

branch_dirs = {
source: {
"Steam": {
"Half-Life 2": ["Half-Life 2/hl2/maps"],
"Half-Life 2: Episode 1": ["Half-Life 2/episodic/maps"],
"Half-Life 2: Episode 2": ["Half-Life 2/ep2/maps"],
"Half-Life 2: Lost Coast": ["Half-Life 2/lostcoast/maps"]}}}

library = files.game_library()

bsps.update({
f"{section} | {game} | {short_path}": ValveBsp.from_file(branch, full_path)
for branch, bsp_dirs in branch_dirs.items()
for section, game, paths in library.scan(bsp_dirs, "*.bsp")
for short_path, full_path in paths
if not os.path.getsize(full_path) == 0})

bsps = collections.OrderedDict(sorted(bsps.items()))

# lump headers are totally incorrect
if "Steam | Half-Life 2: Episode 1 | ep1_citadel_00_demo.bsp" in bsps:
bsps.pop("Steam | Half-Life 2: Episode 1 | ep1_citadel_00_demo.bsp")


@pytest.mark.parametrize("bsp", bsps.values(), ids=bsps.keys())
def test_no_errors(bsp):
Expand All @@ -25,6 +52,7 @@ def test_no_errors(bsp):

@pytest.mark.parametrize("bsp", bsps.values(), ids=bsps.keys())
def test_entities_loaded(bsp):
assert "ENTITIES" not in bsp.loading_errors
assert bsp.ENTITIES[0]["classname"] == "worldspawn"


Expand Down

0 comments on commit 2a26c19

Please sign in to comment.