Skip to content

Add comprehensive unit test suite for datapack validation#4

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1780927263-add-unit-tests
Open

Add comprehensive unit test suite for datapack validation#4
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1780927263-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

The datapack had zero test coverage. This PR adds a Python/pytest test suite (327 tests across 8 modules) that validates every module of the datapack without needing a running Minecraft server.

What's tested:

Module Tests What it validates
test_pack_structure 12 pack.mcmeta validity, directory layout, pack_format=15
test_json_validity 8 JSON parse validity, load.json/tick.json references resolve, kill.json structure
test_function_references ~30 Every function bf:... call resolves to an existing .mcfunction file
test_scoreboard_consistency 6 Objectives in setup.mcfunctionuninstall.mcfunction symmetry; used objectives are declared
test_team_consistency 8 Red/Blue team setup, teardown, and usage consistency
test_class_system 46 Class selection mapping, loadout completeness (armor, weapons, health, speed), balance checks
test_game_flow 28 Game state machine (0→1→2→0), tick subsystem calls, win condition, reset
test_mechanics 50+ Capture, bleed, death, boundary, base protection, bossbar
test_mcfunction_syntax ~140 Valid command keywords, balanced brackets, consistent line endings
test_uninstall 7 Entity cleanup, scoreboard removal, player state reset

Known bugs surfaced (marked xfail):

  • Squad/ directory uses uppercase but function references use lowercase squad/ — breaks on case-sensitive Linux filesystems
  • 5 Squad-related scoreboard objectives (bf_squad, bf_sq_count, bf_sq_dep, bf_sq_prev, bf_join_sq) are used but never declared in setup.mcfunction
  • kill.json has an empty "function" reward value (invalid JSON)

Run: python -m pytest tests/ -v

Link to Devin session: https://app.devin.ai/sessions/ac54546a203243b5a8069a40919267e3
Requested by: @DanyouTu

- 327 tests across 8 test modules covering all datapack modules
- Tests: pack structure, JSON validity, function references,
  scoreboard consistency, team consistency, class system,
  game flow / state machine, core mechanics, uninstall completeness,
  and mcfunction syntax validation
- Flags 6 known bugs via xfail:
  - Squad directory case mismatch (Squad/ vs squad/ in function refs)
  - 5 undeclared scoreboard objectives for Squad subsystem
- Add .gitignore for __pycache__ and .pytest_cache

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant