Initial commit with translated description

This commit is contained in:
2026-03-29 10:21:46 +08:00
commit 18e90b0b09
67 changed files with 20609 additions and 0 deletions

34
tests/README.md Normal file
View File

@@ -0,0 +1,34 @@
# Unit Tests
## Setup
```bash
# Install test dependencies
pip install -r requirements-test.txt
# Run tests
pytest
# Run with coverage
pytest --cov=scripts --cov-report=html
# Run specific test file
pytest tests/test_portfolio.py
```
## Test Structure
- `test_portfolio.py` - Portfolio CRUD operations
- `test_fetch_news.py` - RSS feed parsing with mocked responses
- `test_setup.py` - Setup wizard validation
- `fixtures/` - Sample RSS and portfolio data
## Coverage Target
60%+ coverage for core functions (portfolio, fetch_news, setup).
## Notes
- Tests use `tmp_path` for file isolation
- Network calls are mocked with `unittest.mock`
- `pytest-mock` provides `mocker` fixture for advanced mocking