712 B
712 B
Unit Tests
Setup
# 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 operationstest_fetch_news.py- RSS feed parsing with mocked responsestest_setup.py- Setup wizard validationfixtures/- Sample RSS and portfolio data
Coverage Target
60%+ coverage for core functions (portfolio, fetch_news, setup).
Notes
- Tests use
tmp_pathfor file isolation - Network calls are mocked with
unittest.mock pytest-mockprovidesmockerfixture for advanced mocking