Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
- Introduced `quick_test.py` for running specific test categories (unit, integration, theme, all). - Updated `run_tests.py` to improve test execution and reporting, including coverage. - Removed outdated test scripts for keyboard shortcuts, menu theming, note saving, and entry updating. - Added new test script `test_theme_changing.py` to verify theme changing functionality. - Consolidated integration tests into `test_integration.py` for comprehensive testing of TheChart application. - Updated theme manager to ensure color retrieval works correctly. - Modified test constants to import from the correct module path.
5.1 KiB
5.1 KiB
TheChart Scripts Directory
This directory contains utility scripts and the new consolidated test suite for TheChart application.
🚀 Quick Start
Run All Tests
cd /home/will/Code/thechart
.venv/bin/python scripts/run_tests.py
Run Specific Test Categories
# Unit tests only
.venv/bin/python scripts/quick_test.py unit
# Integration tests only
.venv/bin/python scripts/quick_test.py integration
# Theme-related tests only
.venv/bin/python scripts/quick_test.py theme
📁 Current Structure
Active Scripts
run_tests.py 🎯
Main test runner - executes the complete test suite with coverage reporting.
- Runs unit tests with coverage
- Runs integration tests
- Runs legacy integration tests for backwards compatibility
- Provides comprehensive test summary
quick_test.py ⚡
Quick test runner - for specific test categories during development.
unit- Fast unit tests onlyintegration- Integration tests onlytheme- Theme-related functionality testsall- Complete test suite
integration_test.py 🔄
Legacy integration test - maintained for backwards compatibility.
- Tests export system functionality
- No GUI dependencies
- Called automatically by the main test runner
Test Organization
Unit Tests (/tests/)
test_*.py- Individual module tests- Uses pytest framework
- Fast execution, isolated tests
- Coverage reporting enabled
Integration Tests (tests/test_integration.py)
- Consolidated integration test suite
- Tests complete workflows and interactions
- Includes functionality from old standalone scripts:
- Note saving and retrieval
- Entry updates and validation
- Theme changing functionality
- Keyboard shortcuts binding
- Menu theming integration
- Export system testing
- Data validation and error handling
🔄 Migration from Old Structure
The old individual test scripts have been consolidated into the unified test suite:
| Old Script | New Location | How to Run |
|---|---|---|
test_note_saving.py |
tests/test_integration.py::test_note_saving_functionality |
quick_test.py integration |
test_update_entry.py |
tests/test_integration.py::test_entry_update_functionality |
quick_test.py integration |
test_keyboard_shortcuts.py |
tests/test_integration.py::test_keyboard_shortcuts_binding |
quick_test.py integration |
test_theme_changing.py |
tests/test_integration.py::test_theme_changing_functionality |
quick_test.py theme |
test_menu_theming.py |
tests/test_integration.py::test_menu_theming_integration |
quick_test.py theme |
Benefits of New Structure
- Unified Framework: All tests use pytest
- Better Organization: Related tests grouped logically
- Improved Performance: Optimized setup/teardown
- Coverage Reporting: Integrated coverage analysis
- CI/CD Ready: Easier automation and integration
🛠️ Development Workflow
During Development
# Quick unit tests (fastest feedback)
.venv/bin/python scripts/quick_test.py unit
# Test specific functionality
.venv/bin/python scripts/quick_test.py theme
Before Commits
# Full test suite with coverage
.venv/bin/python scripts/run_tests.py
Individual Test Debugging
# Run specific test with output
.venv/bin/python -m pytest tests/test_integration.py::TestIntegrationSuite::test_theme_changing_functionality -v -s
# Run with debugger
.venv/bin/python -m pytest tests/test_integration.py::TestIntegrationSuite::test_note_saving_functionality -v -s --pdb
📋 Available Test Categories
Unit Tests
- Fast, isolated component tests
- Mock external dependencies
- Test individual functions and classes
Integration Tests
- Test component interactions
- Test complete workflows
- Validate data persistence
- Test UI functionality (without GUI display)
Theme Tests
- Theme switching functionality
- Color scheme validation
- Menu theming consistency
- Error handling in theme system
System Health Checks
- Configuration file validation
- Manager initialization tests
- Logging system verification
🏃♂️ Performance Tips
- Use
quick_test.py unitfor fastest feedback during development - Use
quick_test.py integrationto test workflow changes - Use
quick_test.py themewhen working on UI/theming - Use
run_tests.pyfor comprehensive testing before commits
🔧 Debugging Tests
Common Commands
# Run with verbose output
.venv/bin/python -m pytest tests/ -v
# Stop on first failure
.venv/bin/python -m pytest tests/ -x
# Show local variables on failure
.venv/bin/python -m pytest tests/ -l
# Run with debugger on failure
.venv/bin/python -m pytest tests/ --pdb
Debugging Specific Issues
# Debug theme issues
.venv/bin/python -m pytest tests/test_integration.py::TestIntegrationSuite::test_theme_changing_functionality -v -s
# Debug data management
.venv/bin/python -m pytest tests/test_data_manager.py -v -s
# Debug export functionality
.venv/bin/python scripts/integration_test.py
📖 See Also: TESTING_MIGRATION.md for detailed migration information.