Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
708b9dd
Implement comprehensive test suite for linux-voice-assistant
May 8, 2026
797edd8
Update testing guide to reflect completed 5-phase test suite
May 8, 2026
22427eb
Update tests README to reflect completed 5-phase implementation
May 8, 2026
5fd2a79
Fix test import errors and add EventBus event tracking
May 8, 2026
f67fcb5
Add missing is_arm() function to util module for test compatibility
May 8, 2026
7e6b564
Fix test failures: format_mac and volume parsing functions
May 8, 2026
9eee922
Fix volume parsing to handle both percentage and decimal formats
May 8, 2026
f5baa12
Add comprehensive test failure analysis
May 8, 2026
a361e54
Fix volume parsing for mocked subprocess tests and add format_mac deb…
May 8, 2026
92ad722
Add comprehensive debugging guide for test failures
May 8, 2026
68cce91
Add comprehensive diagnostic tools for cache/import issues
May 8, 2026
edea0ea
Add direct function test script to diagnose format_mac and volume par…
May 8, 2026
ddfe3cb
Fix volume parsing tests to expect normalized 0-1 range instead of ra…
May 8, 2026
9b31db9
Fix async event loop issues and update MQTT client API
May 9, 2026
b619b25
Fix audio_engine event loop None error in exception handler
May 9, 2026
b4e4ce3
Add test failure categorization script for analyzing remaining test bugs
May 9, 2026
89c71df
Fix test API mismatches and async function calls
May 9, 2026
4a5846a
Fix test failures: API signatures, Preferences model, ButtonController
May 9, 2026
07d95a6
Fix async tests and module-level fixtures
May 9, 2026
4459623
Fix EventBus=None issues and remove duplicate fixtures
May 9, 2026
c43f69a
Fix fixture conflicts between conftest.py and test_end_to_end_workflo…
May 9, 2026
59d8576
Fix fixture resolution by getting event_bus from mock_state
May 9, 2026
5c0eb25
Remove validation scripts and transient debugging documents
May 9, 2026
9744446
Fix MQTT _on_connect signature for paho-mqtt MQTT 5.0 compatibility
May 9, 2026
41f52df
Add development documentation and pytest configuration
May 9, 2026
0dac26e
Delete clear_all_cache.sh
imonlinux May 9, 2026
1e3c662
Fixes for test failures and broken frameworks
imonlinux May 9, 2026
7e37e26
Update documentation and add Docker testing infrastructure
May 9, 2026
2e69f56
Fix Docker testing container with embedded test files
May 9, 2026
9a788f1
Remove Docker testing references from LVA documentation
May 9, 2026
74b0128
Remove Docker-specific files from LVA project root
May 9, 2026
ebfa55c
Update Project Structure section with comprehensive test suite
May 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Tests

on:
push:
branches: [ main, upstream_refactor ]
pull_request:
branches: [ main, upstream_refactor ]
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libportaudio2 \
libmpv-dev \
mpv \
build-essential

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-cov pytest-mock
pip install -e .

- name: Install development dependencies
run: |
pip install black flake8 mypy pylint

- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Check formatting with black
run: |
black --check linux_voice_assistant/ tests/

- name: Type check with mypy
run: |
mypy linux_voice_assistant/ --ignore-missing-imports || true

- name: Run tests with pytest
run: |
pytest tests/ -v --tb=short --cov=linux_voice_assistant --cov-report=xml --cov-report=term-missing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

test-hardware:
runs-on: [self-hosted, linux]
if: github.event_name == 'workflow_dispatch'
strategy:
matrix:
hardware: [xvf3800, resppeaker2mic]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio
pip install -e .

- name: Run hardware-specific tests
run: |
pytest tests/ -v -m hardware -k ${{ matrix.hardware }}

test-performance:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-benchmark
pip install -e .

- name: Run performance benchmarks
run: |
pytest tests/ -v -m benchmark --benchmark-only

security-scan:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run security scan
run: |
pip install bandit
bandit -r linux_voice_assistant/ -f json -o bandit-report.json || true

- name: Upload security scan results
uses: actions/upload-artifact@v4
with:
name: security-scan-results
path: bandit-report.json
94 changes: 87 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ linux-voice-assistant/
│   ├── linux-voice-assistant-xvf3800.md     # ReSpeaker XVF3800 4-Mic USB Array configuration
│   ├── linux-voice-assistant-xvf3800-mute.md # Hardware mute button and LED sync details
│   ├── lva-desktop.md             # Running LVA on a Linux desktop with the tray client
│   ├── testing-guide.md         # Comprehensive testing documentation
│   └── xvf3800_legacy_led_effects_mapping.md # LED functions when running firmware older than 2.0.7
├── linux_voice_assistant
│   ├── api_server.py             # ESPHome API server
Expand All @@ -250,9 +251,11 @@ linux-voice-assistant/
│   ├── __init__.py
│   ├── led_controller.py             # LED effects and state mapping
│   ├── __main__.py                 # Application entry point
│   ├── microwakeword.py # Micro wake word detection module
│   ├── models.py                 # Shared state and data models
│   ├── mpv_player.py             # Media playback via mpv
│   ├── mqtt_controller.py             # MQTT discovery and entity management
│   ├── openwakeword.py # Open wake word detection module
│   ├── satellite.py             # ESPHome voice assistant protocol
│   ├── sendspin                 # Sendspin client subsystem
│   │   ├── client.py             # WebSocket connection and protocol
Expand Down Expand Up @@ -302,13 +305,30 @@ linux-voice-assistant/
│   │   └── timer_finished.flac
│   └── wakeup                 # Wake word triggered sounds
│   └── wake_word_triggered.flac
├── tests
│   ├── lva_mic_capture.py
│   ├── ok_nabu.wav
│   ├── test_microwakeword.py
│   ├── test_openwakeword.py
│   ├── xvf3800_hid_mute_probe.py
│   └── xvf3800_probe.py
├── tests # Comprehensive test suite (293 tests, 99.3% passing)
│ ├── README.md # Test documentation
│ ├── conftest.py # Shared pytest fixtures
│ ├── diagnose_imports.py # Import diagnostic utility
│ ├── test_audio_engine.py # Audio engine tests
│ ├── test_button_controller.py # Button controller tests
│ ├── test_configuration.py # Configuration management tests
│ ├── test_end_to_end_workflows.py # End-to-end integration tests
│ ├── test_event_bus.py # Event system architecture tests
│ ├── test_format_mac.py # MAC address formatting tests
│ ├── test_led_controller.py # LED control tests
│ ├── test_microwakeword.py # MicroWakeWord detection tests
│ ├── test_mqtt_controller.py # MQTT integration tests
│ ├── test_openwakeword.py # OpenWakeWord detection tests
│ ├── test_sendspin_client.py # Sendspin client tests
│ ├── test_sendspin_discovery.py # Sendspin discovery tests
│ ├── test_state_management.py # State management tests
│ ├── test_volume_management.py # Volume control tests
│ ├── test_xvf3800_button_controller.py # XVF3800 button hardware tests
│ ├── test_xvf3800_led_backend.py # XVF3800 LED hardware tests
│ ├── lva_mic_capture.py # Audio capture utility
│ ├── ok_nabu.wav # Test audio file
│ ├── xvf3800_hid_mute_probe.py # XVF3800 hardware probe
│ └── xvf3800_probe.py # XVF3800 device probe
├── wakewords                 # Wake word models
│   ├── alexa.json
│   ├── alexa.tflite
Expand Down Expand Up @@ -359,6 +379,66 @@ linux-voice-assistant/

---

## Development & Testing

### Running Tests

The project includes a comprehensive test suite covering the fork's new architecture:

```bash
# Install development dependencies
./script/setup --dev

# Run all tests
./script/test

# Run specific test file
./script/test test_event_bus.py

# Run with coverage report
pytest tests/ --cov=linux_voice_assistant --cov-report=html

# Run specific test with verbose output
pytest tests/test_event_bus.py -v

# Run excluding hardware tests
pytest tests/ -m "not hardware"
```

### Test Structure

- **Unit Tests**: Core architecture (EventBus, State, Configuration)
- **Integration Tests**: Controllers and hardware abstractions
- **Hardware Tests**: Physical device integration (XVF3800, ReSpeaker)
- **End-to-End Tests**: Complete voice assistant workflows

### Current Test Status

- **Total Tests**: 293
- **Passing**: 291 (99.3%)
- **Skipped**: 2 (hardware-dependent tests)
- **Test Framework**: pytest 7.4.4 with asyncio, mock, and coverage support

See [Testing Guide](docs/testing-guide.md) for detailed testing documentation and [tests/README.md](tests/README.md) for test-specific information.

### Code Quality

```bash
# Format code
black linux_voice_assistant/ tests/

# Lint code
flake8 linux_voice_assistant/ tests/

# Type checking
mypy linux_voice_assistant/

# Run diagnostics
python tests/diagnose_imports.py
```

---

## License

Licensed under the [Apache License 2.0](LICENSE.md).
Expand Down
Loading
Loading