Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/visualization/example_interactive_multilayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
print(" Plotly is available")
except ImportError:
print(" Plotly not found. Install with: pip install plotly")
exit(1)
print(" Skipping interactive visualization example")
exit(0)

# Create a multilayer network
print("\nStep 1: Creating multilayer network...")
Expand Down
27 changes: 27 additions & 0 deletions tests/test_example_interactive_multilayer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import subprocess
import sys
from pathlib import Path


REPO_ROOT = Path(__file__).resolve().parents[1]
EXAMPLE_FILE = REPO_ROOT / "examples" / "visualization" / "example_interactive_multilayer.py"


def test_interactive_multilayer_example_handles_missing_plotly():
"""Example should not fail the suite when optional plotly dependency is absent."""
result = subprocess.run(
[sys.executable, str(EXAMPLE_FILE)],
cwd=REPO_ROOT,
capture_output=True,
text=True,
timeout=60,
env={
**os.environ,
"PYTHONPATH": str(REPO_ROOT),
"FAST_EXAMPLES": "1",
"TQDM_DISABLE": "1",
"PYTHONWARNINGS": "ignore",
},
)
assert result.returncode == 0, result.stderr or result.stdout
Loading