29 lines
1.2 KiB
Markdown
29 lines
1.2 KiB
Markdown
# 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:
|
|
```bash
|
|
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.
|