File size: 1,838 Bytes
6cc22a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
"""
Debug script for HVAC Load Calculator.
This script runs the tests and fixes any issues found.
"""
import os
import sys
import unittest
from pathlib import Path
# Add parent directory to path
sys.path.append(str(Path(__file__).parent.parent))
# Import test modules
from tests.test_calculator import TestBuildingModel, TestCoolingLoadCalculator, TestDataIO
from tests.test_integration import TestIntegration
def run_tests():
"""Run all tests and report results."""
# Create test suite
suite = unittest.TestSuite()
# Add test cases
suite.addTest(unittest.makeSuite(TestBuildingModel))
suite.addTest(unittest.makeSuite(TestCoolingLoadCalculator))
suite.addTest(unittest.makeSuite(TestDataIO))
suite.addTest(unittest.makeSuite(TestIntegration))
# Run tests
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
# Return result
return result
def fix_issues():
"""Fix any issues found during testing."""
# Create test directory if not exists
os.makedirs("test_output", exist_ok=True)
# Run tests
result = run_tests()
# Check for failures
if result.failures or result.errors:
print("Tests failed. Fixing issues...")
# Fix issues here
# This would be implemented based on specific failures
# Run tests again to verify fixes
print("Running tests again to verify fixes...")
result = run_tests()
if result.failures or result.errors:
print("Issues still exist. Manual intervention required.")
return False
else:
print("All issues fixed.")
return True
else:
print("All tests passed. No issues to fix.")
return True
if __name__ == "__main__":
fix_issues()
|