Contributing¶
Thank you for your interest in contributing to repo-people!
Development Setup¶
Clone the repository:
git clone https://github.com/amckenna41/repo-people.git cd repo-people
Install dependencies with Poetry:
poetry installOr with pip in a virtual environment:
python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt
Set your GitHub token (required for integration tests):
export GITHUB_TOKEN="ghp_YOUR_TOKEN_HERE"
Running Tests¶
Run the full test suite (unit tests only — no network calls):
pytest tests/ -v
Run a specific test file:
pytest tests/test_repo_people.py -v
Run with coverage:
pytest tests/ --cov=repo_people --cov-report=term-missing
Integration Tests¶
Integration tests make real GitHub API calls and are skipped by default unless a
GITHUB_TOKEN environment variable is set. They are decorated with
@pytest.mark.skipif to guard against missing credentials:
GITHUB_TOKEN="ghp_..." pytest tests/ -v
Test Structure¶
File |
Contents |
|---|---|
|
Unit tests for |
|
Unit tests for |
|
Unit tests (mocked) and integration tests (live API) for the nine
|
Mocking Pattern¶
All unit tests patch the PyGithub client with unittest.mock.patch or
unittest.mock.MagicMock. The standard pattern used throughout the test
suite is:
from unittest.mock import patch, MagicMock
@patch("repo_people.repo_people.Github")
def test_something(self, mock_github):
mock_gh = MagicMock()
mock_github.return_value = mock_gh
rp = RepoPeople("owner", "repo", token="test_token")
# ... set up mock_gh.get_repo.return_value etc.
Code Style¶
Follow PEP 8. Use
flake8orruffto check your changes.Add a concise single-line comment for each logical block added.
Keep functions focused — prefer small, composable helpers over large monoliths.
New public methods require docstrings (Google style).
Submitting a Pull Request¶
Fork the repository and create a feature branch from
main:git checkout -b feature/my-improvementImplement your changes and add tests for any new behaviour.
Ensure the full test suite passes:
pytest tests/ -vOpen a pull request against
mainand describe what was changed and why.
Reporting Issues¶
Open an issue on GitHub and include:
A minimal reproducible example.
The repository you were running against (owner/repo).
The Python and
repo-peopleversions you are using.The full traceback if applicable.