Add server monitoring functionality and update Makefile and requirements

- 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.
This commit is contained in:
2025-08-27 01:17:15 +03:00
parent 9688cdd85f
commit 0b2440e586
7 changed files with 629 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: help test test-db test-coverage test-html clean install
.PHONY: help test test-db test-coverage test-html clean install test-monitor
# Default target
help:
@@ -11,6 +11,7 @@ help:
@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"
@@ -49,6 +50,10 @@ test-utils:
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
@@ -69,5 +74,7 @@ clean:
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