[triage-generated] [optimization] test_introspection::test_returns_dict_with_expected_keys takes 31.8s #172

Closed
opened 2026-03-15 15:39:55 +00:00 by hermes · 0 comments
Collaborator

Problem

The slowest test in the entire suite is tests/timmy/test_introspection.py::TestRunSelfTests::test_returns_dict_with_expected_keys at 31.84 seconds.

It calls run_self_tests(scope="tests/timmy/test_introspection.py") which spawns an actual pytest subprocess to run tests. This is pytest-inside-pytest.

Why It Matters

31s for a single test is 44% of the total 72s test run. It's marked @pytest.mark.slow but still runs in the default suite.

Fix

Option A (preferred): Exclude @pytest.mark.slow from the default tox -e unit run. Add -m "not slow" to the pytest args in tox.ini. Run slow tests separately.

Option B: Mock the subprocess call in the test so it doesn't actually spawn pytest.

Files

  • tests/timmy/test_introspection.py:168 — the test
  • tox.ini or pyproject.toml — add -m "not slow" to default test config

Acceptance Criteria

  • Default tox -e unit completes in under 60s
  • Slow tests still run but in a separate command (e.g., tox -e slow)

Tags

[triage-generated] [optimization]

## Problem The slowest test in the entire suite is `tests/timmy/test_introspection.py::TestRunSelfTests::test_returns_dict_with_expected_keys` at **31.84 seconds**. It calls `run_self_tests(scope="tests/timmy/test_introspection.py")` which spawns an actual `pytest` subprocess to run tests. This is pytest-inside-pytest. ## Why It Matters 31s for a single test is 44% of the total 72s test run. It's marked `@pytest.mark.slow` but still runs in the default suite. ## Fix Option A (preferred): Exclude `@pytest.mark.slow` from the default `tox -e unit` run. Add `-m "not slow"` to the pytest args in tox.ini. Run slow tests separately. Option B: Mock the subprocess call in the test so it doesn't actually spawn pytest. ## Files - `tests/timmy/test_introspection.py:168` — the test - `tox.ini` or `pyproject.toml` — add `-m "not slow"` to default test config ## Acceptance Criteria - Default `tox -e unit` completes in under 60s - Slow tests still run but in a separate command (e.g., `tox -e slow`) ## Tags [triage-generated] [optimization]
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#172