Skip to content

Commit 82c09bd

Browse files
Merge pull request #13 from bradmontgomery/v0.7.0
Updates for v0.7.0
2 parents c54015d + 307a905 commit 82c09bd

23 files changed

+1075
-169
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12", "3.13"]
16+
django-version: ["4.2", "5.2"]
17+
include:
18+
# Python 3.14 (prerelease) - only test with Django 5.2+
19+
- python-version: "3.14"
20+
django-version: "5.2"
21+
exclude:
22+
# Django 5.2 requires Python 3.10+
23+
# (all our Python versions meet this requirement)
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v4
30+
with:
31+
version: "latest"
32+
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
allow-prereleases: true
38+
39+
- name: Install dependencies
40+
run: |
41+
uv sync --group test
42+
uv pip install "django~=${{ matrix.django-version }}.0"
43+
44+
- name: Run tests
45+
run: uv run pytest -v
46+
47+
- name: Check code compiles
48+
run: uv run python -m compileall rainbowtests
49+
50+
lint:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v4
57+
with:
58+
version: "latest"
59+
60+
- name: Set up Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: "3.12"
64+
65+
- name: Install dependencies
66+
run: uv sync --group dev
67+
68+
- name: Run ruff check
69+
run: uv run ruff check .
70+
71+
build:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Install uv
77+
uses: astral-sh/setup-uv@v4
78+
with:
79+
version: "latest"
80+
81+
- name: Set up Python
82+
uses: actions/setup-python@v5
83+
with:
84+
python-version: "3.12"
85+
86+
- name: Install build tools
87+
run: uv pip install build
88+
89+
- name: Build package
90+
run: python -m build
91+
92+
- name: Check package installs
93+
run: uv pip install dist/*.whl

AGENTS.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# AI Agent Guidelines (AGENTS.md)
2+
3+
This repository is a small Django test-runner package intended to make test output more human-friendly by highlighting the most relevant portions of tracebacks and messages.
4+
5+
## Goals
6+
7+
- Prefer small, focused changes.
8+
- Preserve existing behavior unless the task explicitly requires a behavior change.
9+
- Keep the library usable as a drop-in Django `TEST_RUNNER`.
10+
11+
## Local setup
12+
13+
This project uses [uv](https://github.com/astral-sh/uv) for dependency management.
14+
15+
```bash
16+
# Clone the repository
17+
git clone https://github.com/bradmontgomery/django-rainbowtests.git
18+
cd django-rainbowtests
19+
20+
# Install all dependencies (dev + test)
21+
uv sync --group dev --group test
22+
```
23+
24+
## How to validate changes
25+
26+
Run the test suite:
27+
28+
```bash
29+
uv run pytest
30+
```
31+
32+
Run the linter:
33+
34+
```bash
35+
uv run ruff check .
36+
```
37+
38+
Ensure the code compiles:
39+
40+
```bash
41+
uv run python -m compileall rainbowtests
42+
```
43+
44+
If you have a sample Django project handy, validate integration by setting:
45+
46+
```python
47+
TEST_RUNNER = 'rainbowtests.test.runner.RainbowDiscoverRunner'
48+
```
49+
50+
...and running `python manage.py test`.
51+
52+
## Code & style conventions
53+
54+
- Do not do repo-wide reformatting unless explicitly requested.
55+
- Avoid adding new dependencies for minor changes.
56+
- Keep color/output behavior changes isolated to the existing modules (`rainbowtests/colors.py`, `rainbowtests/messages.py`, and `rainbowtests/test/*`) when possible.
57+
- Use `uv run ruff check --fix .` to fix lint issues.
58+
59+
## Python/Django Compatibility
60+
61+
- **Python**: 3.10, 3.11, 3.12, 3.13, 3.14
62+
- **Django**: 4.2, 5.2
63+
64+
## Packaging / docs
65+
66+
- Packaging is managed via `pyproject.toml` (PEP 517/621 with setuptools).
67+
- Version is defined in `rainbowtests/__init__.py` and read dynamically by setuptools.
68+
- Keep documentation consistent with packaging metadata.
69+
- Prefer Markdown for documentation.
70+
71+
## Safety & privacy
72+
73+
- Do not add secrets (API keys, tokens) to code, tests, docs, or CI.
74+
- Do not print environment variables or filesystem paths that could contain sensitive info.

AUTHORS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Authors & Contributors
2+
3+
- Brad Montgomery (<https://github.com/bradmontgomery>)
4+
- Aaron Bassett (<https://github.com/aaronbassett>)
5+
- Michael Allen (<https://github.com/michaeldfallen>)
6+
- Paul Cochrane (<https://github.com/paultcochrane>)

AUTHORS.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

LICENSE.txt renamed to LICENSE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Copyright (c) 2016, Brad Montgomery <brad@bradmontgomery.net>
1+
# MIT License
2+
3+
Copyright (c) 2026, Brad Montgomery <brad@bradmontgomery.net>
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy of
46
this software and associated documentation files (the "Software"), to deal in

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include README.rst LICENSE.txt
1+
include README.md LICENSE.md
22
recursive-include rainbowtests *.py

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# django-rainbowtests
2+
3+
[![PyPI version](http://img.shields.io/pypi/v/django-rainbowtests.svg?style=flat-square)](https://pypi.python.org/pypi/django-rainbowtests/)
4+
[![License](http://img.shields.io/pypi/l/django-rainbowtests.svg?style=flat-square)](https://pypi.python.org/pypi/django-rainbowtests/)
5+
[![CI](https://github.com/bradmontgomery/django-rainbowtests/actions/workflows/ci.yml/badge.svg)](https://github.com/bradmontgomery/django-rainbowtests/actions/workflows/ci.yml)
6+
7+
This is a custom test runner for Django that gives you *really* colorful test output.
8+
9+
## Installation
10+
11+
Install the latest release with:
12+
13+
```bash
14+
pip install django-rainbowtests
15+
```
16+
17+
Or with uv:
18+
19+
```bash
20+
uv add django-rainbowtests
21+
```
22+
23+
## Usage
24+
25+
Set your test runner in Django settings:
26+
27+
```python
28+
TEST_RUNNER = 'rainbowtests.test.runner.RainbowDiscoverRunner'
29+
```
30+
31+
Then run your tests as usual:
32+
33+
```bash
34+
python manage.py test
35+
```
36+
37+
## Settings
38+
39+
### RAINBOWTESTS_HIGHLIGHT_PATH
40+
41+
While running your tests, any lines in your tracebacks that match this path will be highlighted, making them easier to find and read. If you omit this setting, the default is to use the path to your Django installation.
42+
43+
```python
44+
RAINBOWTESTS_HIGHLIGHT_PATH = '/path/to/my/project/'
45+
```
46+
47+
### RAINBOWTESTS_SHOW_MESSAGES
48+
49+
If the test output is too verbose and you just want a colorful version of the standard Django test output, set `RAINBOWTESTS_SHOW_MESSAGES` to `False`:
50+
51+
```python
52+
RAINBOWTESTS_SHOW_MESSAGES = False
53+
```
54+
55+
## Python/Django Compatibility
56+
57+
- **Python**: 3.10, 3.11, 3.12, 3.13, 3.14
58+
- **Django**: 4.2, 5.2
59+
60+
## Coverage
61+
62+
There is support for [coverage](http://nedbatchelder.com/code/coverage/) via a custom test runner:
63+
64+
```python
65+
TEST_RUNNER = 'rainbowtests.test.runner.RainbowDiscoverCoverageRunner'
66+
```
67+
68+
Run your tests as normal (`python manage.py test`), and if you have coverage installed, you should see a report when your tests complete.
69+
70+
**Note:** The recommended modern workflow is to use `coverage run manage.py test` directly, which gives you more control over coverage settings.
71+
72+
## Development
73+
74+
This project uses [uv](https://github.com/astral-sh/uv) for dependency management.
75+
76+
```bash
77+
# Clone the repository
78+
git clone https://github.com/bradmontgomery/django-rainbowtests.git
79+
cd django-rainbowtests
80+
81+
# Install dependencies
82+
uv sync --group dev --group test
83+
84+
# Run tests
85+
uv run pytest
86+
87+
# Run linter
88+
uv run ruff check .
89+
```
90+
91+
## License
92+
93+
MIT. See [LICENSE.md](LICENSE.md).

README.rst

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)