Skip to content

TST mock download_subject test to improve flakyness#640

Merged
mvdoc merged 3 commits into
mainfrom
tst/download_timeout
May 12, 2026
Merged

TST mock download_subject test to improve flakyness#640
mvdoc merged 3 commits into
mainfrom
tst/download_timeout

Conversation

@mvdoc
Copy link
Copy Markdown
Contributor

@mvdoc mvdoc commented May 11, 2026

Downloading the test subject may take some time

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a 600-second timeout for the test_download_subject test in cortex/tests/test_utils.py. Feedback indicates that this duration is excessively long for a single test and suggests refactoring the implementation to avoid redundant downloads or using a mock subject to improve CI efficiency.

Comment thread cortex/tests/test_utils.py Outdated
import cortex
import pytest

@pytest.mark.timeout(600)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

A timeout of 600 seconds (10 minutes) is exceptionally long for a single test and can significantly delay CI feedback loops. This duration is largely driven by the fact that the test downloads the 'fsaverage' subject twice (once on line 13 and again on line 16 with download_again=True).

To improve efficiency and reduce the risk of hitting timeouts, consider refactoring the test to:

  1. Download the subject only once.
  2. Use a smaller mock subject if the goal is specifically to test the download mechanism.
  3. Mark the test with @pytest.mark.slow or a custom network marker so it can be optionally skipped during rapid local development.

mvdoc and others added 2 commits May 11, 2026 10:08
Replaces the real fsaverage download with a fake in-memory tarball and an
isolated filestore, so tests no longer race on download bandwidth or time
out under concurrent CI runs. Adds coverage for the skip-when-present and
download_again=True branches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mvdoc mvdoc changed the title TST increase timeout for download_subject test TST mock download_subject test to improve flakyness May 12, 2026
@mvdoc mvdoc merged commit 74ff2f6 into main May 12, 2026
13 checks passed
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