A portable conformance test suite for MOO (MUD Object Oriented) language implementations. Tests are defined in YAML format and can be run against any MOO server via TCP socket.
- YAML-based tests: Declarative, easy to read and write
- Socket transport: Tests any MOO server over TCP
- pytest integration: Standard Python testing workflow
- pip installable:
pip install moo-conformance-tests - Bundled database: Includes Test.db for toaststunt compatibility
pip install moo-conformance-tests
# or with uv
uv add moo-conformance-tests-
Start your MOO server on port 7777:
# Example with toaststunt ./moo Test.db Test.out.db 7777 -
Run the conformance tests:
moo-conformance --moo-port=7777 # or via pytest directly pytest --pyargs moo_conformance --moo-port=7777
# Run directly from PyPI (no install needed)
uv tool run moo-conformance-tests --moo-port=7777
# Or from a local checkout
uv run moo-conformance --moo-port=7777-
Lint for duplicate test definitions:
moo-lint-duplicates # or from source uv run moo-lint-duplicatesAuto-clean duplicate content definitions:
# keep most descriptive test in each duplicate group (default strategy) moo-lint-duplicates --only content --fix-content # deterministic alternatives moo-lint-duplicates --only content --fix-content --keep-strategy first moo-lint-duplicates --only content --fix-content --keep-strategy last moo-lint-duplicates --only content --fix-content --keep-strategy longest-name
Duplicate matching is exact structural matching after normalization (dictionary key order normalized;
nameignored;descriptionignored by default). It is not fuzzy semantic equivalence.Semantic-lite duplicate checks (uses
moo-interpparser/compiler):# run semantic check only moo-lint-duplicates --only semantic # run names/content checks plus semantic check moo-lint-duplicates --semantic # auto-clean semantic duplicates moo-lint-duplicates --only semantic --fix-semantic
Semantic mode is bytecode-equivalence based for runnable MOO snippets (
code,statement,runfields). It is stronger than text matching, but still not full program-equivalence.
git clone https://github.com/MongooseMoo/moo-conformance-tests
cd moo-conformance-tests
uv sync
uv run pytest tests/ --moo-port=7777Instead of starting a server yourself, pass --server-command and the tool handles the lifecycle automatically. Use {port} and {db} placeholders in the command template:
# Toaststunt (positional args: db logfile port)
moo-conformance --server-command "./moo {db} /dev/null {port}" -v
# Barn (flag args)
moo-conformance --server-command "./barn -db {db} -port {port}" -v
# With a specific port
moo-conformance --server-command "./moo {db} /dev/null {port}" --moo-port 9898 -v
# With a custom database file
moo-conformance --server-command "./moo {db} /dev/null {port}" --server-db ./MyTest.db -vThe tool copies the database to a temp directory (servers write checkpoints alongside it), starts the server, waits for it to accept connections, runs the tests, and cleans everything up on exit. When --moo-port is omitted, a free port is selected automatically.
| Option | Default | Description |
|---|---|---|
--moo-host |
localhost |
MOO server hostname |
--moo-port |
7777 |
MOO server port |
--server-command |
(none) | Shell command to start a MOO server ({port} and {db} placeholders) |
--server-db |
bundled Test.db |
Database file for managed server |
Tests are organized by category:
| Directory | Description |
|---|---|
basic/ |
Expression tests (arithmetic, strings, lists) |
builtins/ |
Builtin function tests |
language/ |
Language construct tests (loops, equality) |
server/ |
Server feature tests |
objects/ |
Object system tests |
features/ |
Advanced feature tests |
Run specific categories:
# Run only arithmetic tests
moo-conformance -k "arithmetic" --moo-port=7777
# Run all builtin tests
moo-conformance -k "builtins" --moo-port=7777The test suite was developed against toaststunt, the reference MOO implementation.
# Start toaststunt
cd /path/to/toaststunt
./moo Test.db Test.out.db 9898
# Run tests
moo-conformance --moo-port=9898 -vSee docs/TOASTSTUNT.md for detailed setup instructions.
Tests are defined in YAML files:
name: arithmetic
description: Basic arithmetic operations
tests:
- name: addition
code: "1 + 1"
expect:
value: 2
- name: division_by_zero
code: "1 / 0"
expect:
error: E_DIV
- name: random_range
code: "random(10)"
expect:
range: [1, 10]See docs/YAML_SCHEMA.md for the full schema.
from moo_conformance import SocketTransport, YamlTestRunner, discover_yaml_tests
# Connect to server
transport = SocketTransport("localhost", 7777)
transport.connect("wizard")
# Execute code directly
result = transport.execute("1 + 1")
print(result.value) # 2
# Run all tests programmatically
runner = YamlTestRunner(transport)
for yaml_path, suite, test in discover_yaml_tests():
runner.run_suite_setup(suite)
runner.run_test(test)The package includes Test.db, a minimal MOO database for testing. Access it via:
from moo_conformance import get_db_path
db_path = get_db_path()- Create a YAML file in the appropriate category
- Follow the schema in docs/YAML_SCHEMA.md
- Test against toaststunt to verify expected behavior
- Submit a pull request
See docs/CONVERTING.md for converting tests from other formats.
MIT License - see LICENSE for details.
- toaststunt - Reference MOO implementation
- cow_py - Python MOO server
- moo_interp - Python MOO interpreter