Skip to content

Optimize scenario tests: tests/scenarios/event_backtests/ #385

@MDUYN

Description

@MDUYN

Problem

The event backtest scenario tests in tests/scenarios/event_backtests/ are too slow for CI (they cause Ubuntu runners to timeout). They are currently skipped via @unittest.skip.

Required changes

  1. Reduce execution time — The event backtest engine iterates through each time step with multiple DB round-trips per iteration. These tests use long date ranges (100–365 days at 2h intervals = 1200–4380 iterations). Reduce date ranges and/or use coarser time frames to bring each test under ~30 seconds.

  2. Use only offline test data from tests/resources/test_data/ — All data sources must reference CSV files located in tests/resources/test_data/ (or its subdirectories). Tests should not depend on data files scattered across tests/resources/data/ or tests/resources/market_data_sources_for_testing/. This ensures tests are self-contained, reproducible, and don't break when external data files are reorganized.

Affected files

  • tests/scenarios/event_backtests/test_run_backtest_algorithm_param.py
  • tests/scenarios/event_backtests/test_run_backtest_with_pandas_datasources.py
  • tests/scenarios/event_backtests/test_run_backtest_single_strategy_param.py (commented out)
  • tests/scenarios/event_backtests/test_run_backtest_multiple_strategies_param.py (commented out)
  • tests/scenarios/event_backtests/test_run_backtest_strategies_attribute.py (commented out)
  • tests/scenarios/event_backtests/test_run_backtests_algorithms_param.py (commented out)

Acceptance criteria

  • All tests in this folder run in under 30 seconds each
  • All tests use data exclusively from tests/resources/test_data/
  • Remove the @unittest.skip decorator once optimized
  • Tests pass on both macOS and Ubuntu CI runners

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions