SessionIntent includes a Developer Mode for safe testing without side effects.
--dev(-d): Enables "dry-run" mode. Prints commands instead of executing them.--mode <name>(-m): Directly apply a specific mode, bypassing the selection menu.--config <path>(-c): Specify a custom configuration file.--panic(-P): Clear current state (no app termination).--quit(-q): Gracefully close managed apps.--clear: Clear state files only.--kill(-k): Force kill managed apps.--status(-s): Show current session status.--list(-l): List available modes.--reload(-r): Reload configuration files.--suspend(-S): Suspend session.
sessionintent -d -m browsing
# or
sessionintent --dev --mode browsingThis will simulate switching workspaces and launching apps defined in the "browsing" mode.
sessionintent -d -m work -c tests/test_configs/valid.yaml
# or
sessionintent --dev --mode work --config tests/test_configs/valid.yamlsessionintent -d -P
# or
sessionintent --dev --panicsessionintent
# or with dev mode
sessionintent -dNote: UI still shows, but actions are dry-run.
sessionintent -s # Show status
sessionintent -l # List modes
sessionintent -s -l # Show both
sessionintent -r -s # Reload and show status# Installpytest
pip install pytest
# Run all tests
pytest
# Run with verbosity
pytest -v
# Run specific test
pytest tests/test_sessionintent.py::TestSessionManager::test_init_dev_mode
# Run with coverage
pytest --cov=sessionintent --cov-report=xmltests/
├── test_sessionintent.py # Core functionality tests
├── test_configs/ # Valid and invalid test configs
│ ├── valid_config.yaml
│ └── invalid_config.yaml
└── test_app_controllers.py # App controller tests (future)
- Unit Tests: Test individual functions
- Integration Tests: Test full workflows
- Config Tests: Validate YAML parsing
Example:
def test_config_loading():
manager = SessionManager(dev_mode=True)
manager.load_config()
assert manager.config is not None-
Initialize Config
sessionintent -i
-
Edit config (add test mode)
nano ~/.config/sessionintent/config.yaml -
Test dry-run
sessionintent -d -m test-mode
-
Test selection (if UI available)
sessionintent
-
Verify state
sessionintent -s # or cat ~/.local/state/sessionintent/current
# Add print statements or use logging
python3 -c "import logging; logging.basicConfig(level=logging.DEBUG)"python3 -c "import yaml; print(yaml.safe_load(open('config.yaml')))"# Check if app exists
which firefox
# Test pgrep pattern
pgrep -f firefox##常见 Testing Scenarios
- Test in dev mode
- Check pgrep pattern
- Verify
internal_reusesetting
- Check workspace numbers in config
- Verify GNOME shell D-Bus commands
- Test with
--devto see output
- Check YAML syntax
- Verify parameter in mode config
- Test with simple example
SessionIntent uses GitHub Actions for CI:
# Run all checks locally
make testSee .github/workflows/ci.yml for details.