1.2 KiB
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
OpenTTDClientorOpenTTDProtocolclasses. - 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
- Fork the repo and create your branch from
main. - Add tests for your changes.
- Run the full test suite to ensure no regressions and verify 100% coverage.
- Open a Pull Request with a detailed description of your changes.