- Introduced a new server monitoring module in `run_helper.py` with graceful shutdown handling. - Updated `.gitignore` to include PID files. - Added `test-monitor` target in `Makefile` for testing the server monitoring module. - Included `psutil` in `requirements.txt` for system monitoring capabilities.
81 lines
2.3 KiB
Makefile
81 lines
2.3 KiB
Makefile
.PHONY: help test test-db test-coverage test-html clean install test-monitor
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Available commands:"
|
|
@echo " install - Install dependencies"
|
|
@echo " test - Run all tests"
|
|
@echo " test-db - Run database tests only"
|
|
@echo " test-bot - Run bot startup and handler tests only"
|
|
@echo " test-media - Run media handler tests only"
|
|
@echo " test-errors - Run error handling tests only"
|
|
@echo " test-utils - Run utility functions tests only"
|
|
@echo " test-keyboards - Run keyboard and filter tests only"
|
|
@echo " test-monitor - Test server monitoring module"
|
|
@echo " test-coverage - Run tests with coverage report (helper_bot + database)"
|
|
@echo " test-html - Run tests and generate HTML coverage report"
|
|
@echo " clean - Clean up generated files"
|
|
@echo " coverage - Show coverage report only"
|
|
|
|
# Install dependencies
|
|
install:
|
|
python3 -m pip install -r requirements.txt
|
|
python3 -m pip install pytest-cov
|
|
|
|
# Run all tests
|
|
test:
|
|
python3 -m pytest tests/ -v
|
|
|
|
# Run database tests only
|
|
test-db:
|
|
python3 -m pytest tests/test_db.py -v
|
|
|
|
# Run bot tests only
|
|
test-bot:
|
|
python3 -m pytest tests/test_bot.py -v
|
|
|
|
# Run media handler tests only
|
|
test-media:
|
|
python3 -m pytest tests/test_media_handlers.py -v
|
|
|
|
# Run error handling tests only
|
|
test-errors:
|
|
python3 -m pytest tests/test_error_handling.py -v
|
|
|
|
# Run utils tests only
|
|
test-utils:
|
|
python3 -m pytest tests/test_utils.py -v
|
|
|
|
# Run keyboard and filter tests only
|
|
test-keyboards:
|
|
python3 -m pytest tests/test_keyboards_and_filters.py -v
|
|
|
|
# Test server monitoring module
|
|
test-monitor:
|
|
python3 tests/test_monitor.py
|
|
|
|
# Run tests with coverage
|
|
test-coverage:
|
|
python3 -m pytest tests/ --cov=helper_bot --cov=database --cov-report=term
|
|
|
|
# Run tests and generate HTML coverage report
|
|
test-html:
|
|
python3 -m pytest tests/ --cov=helper_bot --cov=database --cov-report=html:htmlcov --cov-report=term
|
|
@echo "HTML coverage report generated in htmlcov/index.html"
|
|
|
|
# Show coverage report only
|
|
coverage:
|
|
python3 -m coverage report --include="helper_bot/*,database/*"
|
|
|
|
# Clean up generated files
|
|
clean:
|
|
rm -rf htmlcov/
|
|
rm -f coverage.xml
|
|
rm -f .coverage
|
|
rm -f database/test.db
|
|
rm -f test.db
|
|
rm -f helper_bot.pid
|
|
rm -f voice_bot.pid
|
|
find . -type d -name "__pycache__" -exec rm -rf {} +
|
|
find . -type f -name "*.pyc" -delete
|