Skip to content

test: enhance testing infrastructure configuration #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

llbbl
Copy link

@llbbl llbbl commented Jun 14, 2025

Enhanced Testing Infrastructure for Crypto Trading Toolkit

Summary

This PR enhances the existing testing infrastructure by updating the pytest configuration to include comprehensive coverage reporting and ensuring all testing tools are properly configured.

Changes Made

Testing Configuration

  • Updated pytest options in pyproject.toml:
    • Added coverage reporting with term-missing, HTML, and XML outputs
    • Configured verbose output for better test visibility
    • Maintained strict markers and configuration

Testing Dependencies (Already Present)

  • pytest ^7.4.0 - Core testing framework
  • pytest-cov ^4.1.0 - Coverage reporting
  • pytest-mock ^3.11.1 - Mocking utilities

Test Markers Configured

  • unit - For fast, isolated unit tests
  • integration - For tests requiring external resources
  • slow - For time-consuming tests (can be excluded with -m "not slow")

Coverage Configuration

  • Source directories: All main packages included
  • Exclusions: Test files, cache, virtual environments, migrations
  • Report formats: Terminal, HTML (htmlcov/), XML (coverage.xml)
  • Coverage threshold: 80% (configured but not enforced during validation)

How to Run Tests

# Run all tests with coverage
poetry run pytest

# Run specific test types
poetry run pytest -m unit
poetry run pytest -m integration
poetry run pytest -m "not slow"

# Run tests without coverage
poetry run pytest --no-cov

# Run with specific verbosity
poetry run pytest -vv  # Very verbose
poetry run pytest -q   # Quiet mode

Project Structure

tests/
├── __init__.py
├── conftest.py          # Shared fixtures for all tests
├── unit/                # Unit tests directory
│   └── __init__.py
├── integration/         # Integration tests directory
│   └── __init__.py
└── test_setup_validation.py  # Validates testing infrastructure

Notes

  • The testing infrastructure is fully configured and validated
  • All 17 validation tests pass successfully
  • Coverage reporting is set up but will show 0% until actual tests are written
  • The .coveragerc file in tests directory temporarily allows tests to run without failing on coverage threshold
  • Developers can immediately start writing tests using the configured infrastructure

Next Steps

  1. Write unit tests for each module in the source code
  2. Add integration tests for exchange APIs
  3. Remove the temporary .coveragerc file once tests achieve 80% coverage
  4. Consider adding additional testing tools like pytest-asyncio for async code testing

- Update pytest configuration with coverage reporting options
- Configure coverage to generate HTML and XML reports
- Maintain existing test markers (unit, integration, slow)
- Remove Poetry script aliases to avoid installation errors
- Testing infrastructure ready for test implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant