Files
openttd-client/docs/CONTRIBUTING.md
kovagoadi cb6849ed55
Some checks failed
Continuous Integration / lint-and-security (push) Successful in 4m14s
Continuous Integration / tests-and-coverage (push) Successful in 33s
CodeQL Analysis / Analyze (python) (push) Failing after 4m17s
Initialized openttd-client repo
2026-06-05 23:18:09 +02:00

1.2 KiB

Contributing to OpenTTD Python Client

We welcome contributions from the community! To maintain the high quality of this library, please follow these guidelines.

Code Standards

  • Clean OO Code: Logic must be encapsulated within the OpenTTDClient or OpenTTDProtocol classes.
  • Type Safety: Use type hints where possible.
  • Minimal Dependencies: Only add new dependencies if absolutely necessary.

Testing Mandate

We enforce 100% test coverage. Any new feature or bug fix must include corresponding tests.

Running Tests

Use pytest within the virtual environment:

PYTHONPATH=lib ./venv/bin/pytest --cov=openttd --cov-report=term-missing tests/

Types of Tests

  • Logic Tests (tests/test_logic.py): High-level client state and API behavior.
  • Protocol Tests (tests/test_protocol.py): Low-level binary parsing and encryption.
  • E2E Tests (tests/test_e2e.py): Integration tests against a live server.

Submitting Changes

  1. Fork the repo and create your branch from main.
  2. Add tests for your changes.
  3. Run the full test suite to ensure no regressions and verify 100% coverage.
  4. Open a Pull Request with a detailed description of your changes.