tracker/test_export.py
m1ngsama 5529c0d573 Release v1.0.0: Complete system monitoring solution
Major improvements and features:
- Integrate all monitoring modules (config, alert, logger, temperature)
- Add comprehensive error handling throughout codebase
- Fix data exporter directory creation issue
- Improve process monitor CPU accuracy with proper intervals
- Fix logger file handle management

New features:
- Alert system with configurable thresholds
- Automatic logging to daily log files
- Data export to JSON/CSV formats
- Configuration management via config.json
- Temperature monitoring support

CI/CD:
- Add GitHub Actions workflows for automated testing
- Add release workflow for automatic package building
- Multi-platform testing (Linux, macOS, Windows)
- Python 3.8-3.12 compatibility testing

Package distribution:
- Add setup.py and pyproject.toml for PyPI distribution
- Add MANIFEST.in for proper file inclusion
- Add comprehensive CHANGELOG.md
- Update README with full documentation

Bug fixes:
- Fix ResourceWarning in logger
- Add ZombieProcess exception handling
- Improve error handling in all metric collection methods
2025-11-25 16:12:46 +08:00

26 lines
706 B
Python

#!/usr/bin/env python3
"""Test data export functionality"""
from data_exporter import DataExporter
# Test data
test_data = [
{'timestamp': '2025-11-25 15:00:00', 'cpu': 45.2, 'memory': 60.1},
{'timestamp': '2025-11-25 15:05:00', 'cpu': 52.3, 'memory': 62.5},
{'timestamp': '2025-11-25 15:10:00', 'cpu': 48.9, 'memory': 61.8}
]
exporter = DataExporter()
# Test JSON export
json_file = exporter.export_to_json(test_data)
print(f"✓ JSON export successful: {json_file}")
# Test CSV export
csv_file = exporter.export_to_csv(test_data)
print(f"✓ CSV export successful: {csv_file}")
print("\nExport directory contents:")
import os
for file in os.listdir('exports'):
print(f" - {file}")