This guide shows how to use WUP (What's Up) with TestQL to monitor file changes and run intelligent regression tests.
TestQL is a large project with many endpoints. WUP helps by:
- Mapping dependencies: Files → Endpoints → Services
- Watching files: Detects changes in real-time
- Smart testing: Only tests affected services, not all 200+ endpoints
- 3-layer approach: Quick smoke tests first, detailed tests only on failure
cd /home/tom/github/semcod/wup
pip install -e .If your project is a CLI tool or shell script package, use the automated setup:
# Automatically detect CLI commands and generate configuration
wup init-cli /path/to/your/project
# This scans pyproject.toml, setup.py, setup.cfg for entry points
# Generates wup.yaml with shell service configuration
# Creates TestQL scenarios in testql-scenarios/
# Example output:
# ✓ Found 1 package(s)
# mycli: 3 command(s)
# - mycli -> mycli.cli:main
# - mycli-build -> mycli.build:main
# - mycli-test -> mycli.test:main
# Merge with existing wup.yaml
wup init-cli /path/to/your/project --merge
# Custom output paths
wup init-cli /path/to/your/project --output-config custom.yaml --output-scenarios custom-scenarios
# Skip argument inference (faster)
wup init-cli /path/to/your/project --no-infer-argsWhat init-cli does:
- Scans project for CLI entry points in
pyproject.toml,setup.py,setup.cfg - Detects packages with
__main__.pymodules - Generates shell service configuration in
wup.yamlwith appropriate test settings - Creates TestQL scenarios for CLI commands:
cli-smoke.testql.toon.yaml- Smoke tests for all commandscli-{command}.testql.toon.yaml- Detailed tests for each command
- Automatically infers command arguments by inspection (can be disabled)
- Supports merging with existing
wup.yamlconfigurations
Generated TestQL Scenarios:
The generated scenarios use TestQL's SHELL directive to test CLI commands:
# cli-smoke.testql.toon.yaml
# Test: mycli --help
SHELL "mycli --help" 5000
ASSERT_EXIT_CODE 0
ASSERT_STDOUT_CONTAINS "usage"
# Test: mycli-build --help
SHELL "mycli-build --help" 5000
ASSERT_EXIT_CODE 0
ASSERT_STDOUT_CONTAINS "build"# Navigate to your project
cd /path/to/your/project
# Build the dependency map
wup map-deps . --framework auto
# Or specify output file
wup map-deps . --output wup-deps.jsonThis creates a deps.json file mapping:
- Files to endpoints
- Endpoints to services
- Services to related tests
# Basic watching
wup watch .
# With custom settings
wup watch . \
--cpu-throttle 0.7 \
--debounce 3 \
--cooldown 180
# With live dashboard
wup watch . --dashboardWUP automatically detects TestQL services:
testql/
├── commands/ → Service: testql/commands
│ ├── endpoints_cmd.py
│ ├── generate_cmd.py
│ └── run_cmd.py
├── discovery/ → Service: testql/discovery
│ ├── manifest.py
│ └── source.py
├── detectors/ → Service: testql/detectors
│ ├── fastapi_detector.py
│ └── flask_detector.py
└── adapters/ → Service: testql/adapters
└── scenario_yaml.py
When you edit testql/commands/endpoints_cmd.py:
┌──────────────────────────────────────────────────────┐
│ Layer 1: DETECTION │
│ File change detected in testql/commands │
└────────────────────────┬───────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ Layer 2: PRIORITY (Quick Test) │
│ Testing 3 endpoints: │
│ • /api/v1/endpoints │
│ • /api/v1/endpoints/detect │
│ • /api/v1/generate │
│ Duration: ~1-2 seconds │
└────────────────────────┬───────────────────────────────┘
│ All passed?
│ No → Escalate
▼
┌──────────────────────────────────────────────────────┐
│ Layer 3: DETAIL (Full Test) │
│ Running all tests for testql/commands │
│ Generating blame report... │
│ Duration: ~5-10 seconds │
└──────────────────────────────────────────────────────┘
Protect your development machine:
# Use only 50% CPU
wup watch . --cpu-throttle 0.5
# Use up to 80% CPU (default)
wup watch . --cpu-throttle 0.8Prevent test spam:
# Wait 5 seconds after file change before testing
wup watch . --debounce 5
# Minimum 5 minutes between tests of same service
wup watch . --cooldown 300By default, WUP watches:
app/src/tests/
For TestQL, you might want to watch specific directories:
# In your custom watcher script
watcher = TestQLWatcher("/home/tom/github/oqlos/testql")
watcher.start_watching(watch_paths=[
"/home/tom/github/oqlos/testql/testql",
"/home/tom/github/oqlos/testql/scenarios"
])Integrate with TestQL CLI:
# custom_watcher.py
from wup.core import WupWatcher
import subprocess
class TestQLWatcher(WupWatcher):
async def run_quick_test(self, service: str, endpoints: list) -> bool:
"""Run quick TestQL test."""
# Find relevant scenarios
scenarios = self._find_scenarios(service)
for scenario in scenarios[:3]: # Max 3
result = subprocess.run([
"python", "-m", "testql.cli", "run",
str(scenario),
"--dry-run"
])
if result.returncode != 0:
return False
return True
async def run_detail_test(self, service: str, endpoints: list) -> dict:
"""Run full TestQL test with blame report."""
# Run actual TestQL tests
result = subprocess.run([
"pytest", f"tests/{service}/",
"--cov", f"testql/{service}",
"-v"
])
return {
"service": service,
"passed": result.returncode == 0,
"blame": self._generate_blame(service)
}python custom_watcher.py| Scenario | CPU | Time | Endpoints Tested |
|---|---|---|---|
| Idle | 0.1% | - | 0 |
| File change (quick) | 2% | 1-2s | 3 |
| File change (detail) | 15% | 5-10s | 10-50 |
| Full regression | 50% | 30-60s | 200+ |
- Service-based: Tests only affected service, not entire project
- 3-layer: Quick tests catch 90% of issues in 2 seconds
- CPU throttling: Never overwhelms your machine
- Debouncing: Groups rapid file changes
# Check if file is in watched directory
wup status --deps deps.json
# Add custom watch path
wup watch . --path testql/custom_modules# Increase cooldown
wup watch . --cooldown 600 # 10 minutes
# Increase debounce
wup watch . --debounce 5 # 5 seconds# Lower CPU throttle
wup watch . --cpu-throttle 0.3 # Max 30% CPURun the included demo:
cd /home/tom/github/semcod/wup
python3 examples/testql_demo.pyThis shows a simulated integration without actually running the watcher.
- WUP README
- TestQL documentation:
/home/tom/github/oqlos/testql/README.md - Example integration:
examples/testql_integration.py