Overview
angr Management uses pytest for testing with coverage tracking. The test suite includes UI component tests, view tests, and integration tests.Running Tests
Install Test Dependencies
Install the testing dependency group:pytest- Test frameworkpytest-cov- Coverage pluginpytest-durations- Test timing analysispytest-profiling- Performance profilingpytest-split- Test splitting for parallel runspytest-timeout- Test timeout enforcementpytest-xdist- Parallel test executioncoverage- Coverage reporting
Basic Test Execution
Run all tests:Advanced Test Options
Run with timeout (30 seconds per test):Coverage Configuration
Coverage settings are configured inpyproject.toml:
Writing Tests
Test Structure
Tests are located in thetests/ directory. Common test patterns:
Basic UI Component Test:
Test Base Classes
Thetests/common.py module provides base classes:
AngrManagementTestCase
Creates a headless MainWindow for UI testing:
ProjectOpenTestCase
Extends AngrManagementTestCase with a loaded project:
Headless Testing
Create a headless MainWindow by passingshow=False:
- Workspace instance
- Instance management
- All UI components without rendering
Using QTest
Drive UI interactions with QTest:Coverage Support for QThread
The test suite includes automatic QThread coverage patching viaconftest.py. The qthread_coverage fixture patches QThread.run to enable coverage tracking in threaded code:
Test Examples
Explore existing tests for patterns:tests/test_main_window.py- MainWindow shortcuts and event filterstests/test_disassembly_view.py- Disassembly view testingtests/test_code_view.py- Code/decompiler view testingtests/test_hex_view.py- Hex editor testingtests/test_command_palette.py- Command palette testingtests/test_qlinear_viewer.py- Linear viewer component testing
Continuous Integration
Tests run automatically on:- Every pull request
- Every commit to master
- Nightly builds