Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
django-version: ["4.2", "5.2"]
include:
# Python 3.14 (prerelease) - only test with Django 5.2+
- python-version: "3.14"
django-version: "5.2"
exclude:
# Django 5.2 requires Python 3.10+
# (all our Python versions meet this requirement)

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install dependencies
run: |
uv sync --group test
uv pip install "django~=${{ matrix.django-version }}.0"

- name: Run tests
run: uv run pytest -v

- name: Check code compiles
run: uv run python -m compileall rainbowtests

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: uv sync --group dev

- name: Run ruff check
run: uv run ruff check .

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build tools
run: uv pip install build

- name: Build package
run: python -m build

- name: Check package installs
run: uv pip install dist/*.whl
74 changes: 74 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# AI Agent Guidelines (AGENTS.md)

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.

## Goals

- Prefer small, focused changes.
- Preserve existing behavior unless the task explicitly requires a behavior change.
- Keep the library usable as a drop-in Django `TEST_RUNNER`.

## Local setup

This project uses [uv](https://github.com/astral-sh/uv) for dependency management.

```bash
# Clone the repository
git clone https://github.com/bradmontgomery/django-rainbowtests.git
cd django-rainbowtests

# Install all dependencies (dev + test)
uv sync --group dev --group test
```

## How to validate changes

Run the test suite:

```bash
uv run pytest
```

Run the linter:

```bash
uv run ruff check .
```

Ensure the code compiles:

```bash
uv run python -m compileall rainbowtests
```

If you have a sample Django project handy, validate integration by setting:

```python
TEST_RUNNER = 'rainbowtests.test.runner.RainbowDiscoverRunner'
```

...and running `python manage.py test`.

## Code & style conventions

- Do not do repo-wide reformatting unless explicitly requested.
- Avoid adding new dependencies for minor changes.
- Keep color/output behavior changes isolated to the existing modules (`rainbowtests/colors.py`, `rainbowtests/messages.py`, and `rainbowtests/test/*`) when possible.
- Use `uv run ruff check --fix .` to fix lint issues.

## Python/Django Compatibility

- **Python**: 3.10, 3.11, 3.12, 3.13, 3.14
- **Django**: 4.2, 5.2

## Packaging / docs

- Packaging is managed via `pyproject.toml` (PEP 517/621 with setuptools).
- Version is defined in `rainbowtests/__init__.py` and read dynamically by setuptools.
- Keep documentation consistent with packaging metadata.
- Prefer Markdown for documentation.

## Safety & privacy

- Do not add secrets (API keys, tokens) to code, tests, docs, or CI.
- Do not print environment variables or filesystem paths that could contain sensitive info.
6 changes: 6 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Authors & Contributors

- Brad Montgomery (<https://github.com/bradmontgomery>)
- Aaron Bassett (<https://github.com/aaronbassett>)
- Michael Allen (<https://github.com/michaeldfallen>)
- Paul Cochrane (<https://github.com/paultcochrane>)
7 changes: 0 additions & 7 deletions AUTHORS.rst

This file was deleted.

4 changes: 3 additions & 1 deletion LICENSE.txt → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (c) 2016, Brad Montgomery <brad@bradmontgomery.net>
# MIT License

Copyright (c) 2026, Brad Montgomery <brad@bradmontgomery.net>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include README.rst LICENSE.txt
include README.md LICENSE.md
recursive-include rainbowtests *.py
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# django-rainbowtests

[![PyPI version](http://img.shields.io/pypi/v/django-rainbowtests.svg?style=flat-square)](https://pypi.python.org/pypi/django-rainbowtests/)
[![License](http://img.shields.io/pypi/l/django-rainbowtests.svg?style=flat-square)](https://pypi.python.org/pypi/django-rainbowtests/)
[![CI](https://github.com/bradmontgomery/django-rainbowtests/actions/workflows/ci.yml/badge.svg)](https://github.com/bradmontgomery/django-rainbowtests/actions/workflows/ci.yml)

This is a custom test runner for Django that gives you *really* colorful test output.

## Installation

Install the latest release with:

```bash
pip install django-rainbowtests
```

Or with uv:

```bash
uv add django-rainbowtests
```

## Usage

Set your test runner in Django settings:

```python
TEST_RUNNER = 'rainbowtests.test.runner.RainbowDiscoverRunner'
```

Then run your tests as usual:

```bash
python manage.py test
```

## Settings

### RAINBOWTESTS_HIGHLIGHT_PATH

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.

```python
RAINBOWTESTS_HIGHLIGHT_PATH = '/path/to/my/project/'
```

### RAINBOWTESTS_SHOW_MESSAGES

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`:

```python
RAINBOWTESTS_SHOW_MESSAGES = False
```

## Python/Django Compatibility

- **Python**: 3.10, 3.11, 3.12, 3.13, 3.14
- **Django**: 4.2, 5.2

## Coverage

There is support for [coverage](http://nedbatchelder.com/code/coverage/) via a custom test runner:

```python
TEST_RUNNER = 'rainbowtests.test.runner.RainbowDiscoverCoverageRunner'
```

Run your tests as normal (`python manage.py test`), and if you have coverage installed, you should see a report when your tests complete.

**Note:** The recommended modern workflow is to use `coverage run manage.py test` directly, which gives you more control over coverage settings.

## Development

This project uses [uv](https://github.com/astral-sh/uv) for dependency management.

```bash
# Clone the repository
git clone https://github.com/bradmontgomery/django-rainbowtests.git
cd django-rainbowtests

# Install dependencies
uv sync --group dev --group test

# Run tests
uv run pytest

# Run linter
uv run ruff check .
```

## License

MIT. See [LICENSE.md](LICENSE.md).
78 changes: 0 additions & 78 deletions README.rst

This file was deleted.

Loading