Skip to content

MilanLasica/RedLiner

Repository files navigation

RedLiner

A simple Python script that watches a folder for file changes and creates an HTML visualization when tests fail.

Features

  • 🔍 File Watcher: Monitors a folder for any file changes
  • 🧪 Test Runner: Automatically runs tests when files change
  • Error Capture: Captures error messages when tests fail
  • 📊 HTML Visualization: Creates simple HTML files showing:
    • Two boxes (code change → test failure)
    • A red arrow connecting them
    • Full error output displayed below

Installation

pip install -r requirements.txt

Usage

python redliner.py <watch_path> "<test_command>"

Examples

Python with pytest:

python redliner.py . "python -m pytest"

Python with unittest:

python redliner.py . "python -m unittest discover"

JavaScript with npm:

python redliner.py ./src "npm test"

Watch specific directory:

python redliner.py ./src "python -m pytest tests/"

How It Works

  1. The script monitors the specified directory for file changes
  2. When a file is modified or created, it runs your test command
  3. If tests fail, it generates an HTML file in the output/ directory
  4. Open the HTML file in your browser to see the visualization

Output

HTML files are saved in the output/ directory with timestamps:

  • test_failure_20251011_143022.html
  • test_failure_20251011_143145.html
  • etc.

Each file contains:

  • Timestamp of the failure
  • Name of the changed file
  • Visual flow: CODE CHANGE → TEST FAILED
  • Complete error output

Configuration

The script includes a 1-second debounce to avoid running tests too frequently when multiple files change rapidly.

Stopping

Press Ctrl+C to stop watching for changes.

Example Demo

To test the script, create a simple test file:

test_example.py:

def test_always_fails():
    assert 1 == 2, "This test is designed to fail!"

Then run:

python redliner.py . "python -m pytest test_example.py"

Modify test_example.py and watch as an HTML visualization is generated in the output/ folder!

About

Updating Automatic PyCode Scraper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors