Skip to content

Explicitly import Fury before running viz test.#163

Merged
arokem merged 1 commit into
tractometry:mainfrom
arokem:decorate_test
Jan 21, 2026
Merged

Explicitly import Fury before running viz test.#163
arokem merged 1 commit into
tractometry:mainfrom
arokem:decorate_test

Conversation

@arokem

@arokem arokem commented Jan 21, 2026

Copy link
Copy Markdown
Member

This is so that we avoid doing this in minimal sdist.

This is so that we avoid doing this in minimal sdist.
Copilot AI review requested due to automatic review settings January 21, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR explicitly imports the fury library before attempting to import AFQ's visualization utilities to ensure that import failures are caught early, avoiding issues in minimal sdist environments where fury may not be available.

Changes:

  • Added explicit fury import before importing AFQ.viz.utils.Viz
  • Changed the exception handling to set a boolean flag test_viz instead of setting Viz to False
  • Updated the pytest.mark.skipif decorator to check the test_viz flag

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AFQ/tests/test_viz.py
from AFQ.viz.utils import Viz

test_viz = True
except ImportError:

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

When the import fails, the except block sets test_viz to False but doesn't define Viz. If the test somehow runs despite the skipif decorator, it will fail with a NameError when trying to use Viz on line 17. The except block should also set Viz to None or False to ensure the variable is always defined.

Suggested change
except ImportError:
except ImportError:
Viz = None

Copilot uses AI. Check for mistakes.
Comment thread AFQ/tests/test_viz.py
import pytest

try:
import fury # noqa: F401

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

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

Import of 'fury' is not used.

Copilot uses AI. Check for mistakes.
@arokem
arokem merged commit c6ddda8 into tractometry:main Jan 21, 2026
10 of 15 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.

2 participants