Test Suite / test (push) Canceled after 0s
How to run tests (answers user question): Manual execution: ./run_tests.sh # Quick way with auto-configured python python -m pytest tests/unit/ -v # Direct pytest command Automated (Gitea Actions): - Tests run on every push/PR to main branch - Workflow file: .gitea/workflows/test.yml - Status visible at repo actions page CI skips PySide6-dependent GUI tests by default.
61 lines
1.6 KiB
Markdown
61 lines
1.6 KiB
Markdown
# Test Suite
|
|
|
|
This directory contains automated tests for the FLARES project.
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
tests/
|
|
├── unit/ # Unit tests for individual modules
|
|
│ ├── test_updater.py # Security-critical updater module tests
|
|
│ └── ... (more tests TBD)
|
|
├── integration/ # Integration tests for multi-component workflows
|
|
└── fixtures/ # Test data and mock resources
|
|
```
|
|
|
|
## Running Tests
|
|
|
|
```bash
|
|
# Quick way: use the test runner script
|
|
./run_tests.sh
|
|
|
|
# Install dependencies (if needed)
|
|
pip install pytest numpy psutil Pillow
|
|
|
|
# Run all non-GUI unit tests
|
|
python -m pytest tests/unit/ \
|
|
--ignore=tests/unit/test_updater.py \
|
|
--ignore=tests/unit/test_plugin_manager.py \
|
|
--ignore=tests/unit/test_flares.py \
|
|
-v
|
|
|
|
# Run specific test file
|
|
pytest tests/unit/test_security_utils.py -v
|
|
```
|
|
|
|
**Note**: `test_updater.py`, `test_plugin_manager.py`, and `test_flares.py` require PySide6 (GUI framework) and are skipped by default.
|
|
|
|
## Test Coverage Status
|
|
|
|
Current test suite:
|
|
- **security_utils.py**: 30 tests ✅ (all passing)
|
|
- **auth_utils.py**: 12 tests ✅ (all passing)
|
|
- **logging_config.py**: 15 tests ✅ (all passing)
|
|
- **Total**: 57 passing tests
|
|
|
|
See `tests/unit/` for all test files.
|
|
|
|
## CI/CD Integration
|
|
|
|
Tests automatically run on every push via Gitea Actions:
|
|
- Workflow: `.gitea/workflows/test.yml`
|
|
- Status: https://git.research.dezeeuw.ca/hermes/flares/actions
|
|
|
|
|
|
## Writing Tests
|
|
|
|
See existing tests in `tests/unit/test_updater.py` for examples of:
|
|
- Testing utility functions like `version_compare()`
|
|
- Mocking external dependencies (QThread, HTTP requests)
|
|
- Security-focused test cases
|