Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

test(brain): make the live ollama.com guard opt-in and pin the redesigned listing (#443)

Ruben Lütke0ecf547cbb83
diff --git a/tests/integration/test_ollama_library_live.py b/tests/integration/test_ollama_library_live.py
index 607ee8a1b9..6fa75c71f8 100644
--- a/tests/integration/test_ollama_library_live.py
+++ b/tests/integration/test_ollama_library_live.py
@@ -6,18 +6,30 @@ the real search and tags pages and asserts the parsers still read them. The
moment the markup drifts past what the anchors tolerate, this fails loudly at
CI time instead of a user finding an inexplicably empty library panel.
-Network-dependent, so it is marked ``integration`` and self-skips when
-ollama.com cannot be reached. Run explicitly with ``pytest -m integration``.
+Opt-in: it runs only with ``JARVIS_LIVE_NETWORK_TESTS=1``. A third-party
+site redesign is not caused by the change under review, so it must not block
+every pull request at once (the 2026-10 redesign did exactly that). Run it
+when touching the parser, or from a scheduled job that sets the variable:
+``JARVIS_LIVE_NETWORK_TESTS=1 pytest -m integration tests/integration/test_ollama_library_live.py``.
+It also self-skips when ollama.com cannot be reached.
"""
from __future__ import annotations
+import os
+
import httpx
import pytest
from jarvis.brain.ollama_library import _tags_path, parse_search_html, parse_tags_html
-pytestmark = pytest.mark.integration
+pytestmark = [
+ pytest.mark.integration,
+ pytest.mark.skipif(
+ os.environ.get("JARVIS_LIVE_NETWORK_TESTS") != "1",
+ reason="live ollama.com check; opt in with JARVIS_LIVE_NETWORK_TESTS=1",
+ ),
+]
_TIMEOUT = 15.0
diff --git a/tests/unit/brain/test_ollama_library.py b/tests/unit/brain/test_ollama_library.py
index f8b1dde232..6bc533771d 100644
--- a/tests/unit/brain/test_ollama_library.py
+++ b/tests/unit/brain/test_ollama_library.py
@@ -77,6 +77,52 @@ def test_search_parser_answers_empty_on_garbage() -> None:
assert library.parse_search_html("<html><body>maintenance</body></html>") == []
+# Trimmed from the live listing after the 2026-10 redesign: badges are text
+# after an icon ("Embedding"), the pull count sits under a "N downloads" title
+# and the update age is gone.
+_REDESIGNED_ENTRIES = """
+<ul>
+<li class="border-b"><a href="/library/embeddinggemma-2" class="group flex">
+ <h2 title="embeddinggemma-2"><span >embeddinggemma-2</span></h2>
+ <p class="mt-1" title="An embedding model.">An embedding model.</p>
+ <div><span class="group/tip"><span role="tooltip">Runs on your computer</span>
+ <svg aria-hidden="true"><path d="M9 17"/></svg><span class="font-medium">270m</span>
+ <span aria-hidden="true">&middot;</span><span class="font-medium">440m</span></span>
+ <div><span class="inline-flex"><svg aria-hidden="true"><path d="M2"/></svg>Vision</span>
+ <span class="inline-flex"><svg aria-hidden="true"><path d="M21"/></svg>Embedding</span></div>
+ </div>
+ <span class="inline-flex" title="5,435 downloads"><svg aria-hidden="true">
+ <path d="M3"/></svg><span >5,435</span></span>
+</a></li>
+<li class="border-b"><a href="/library/glm-5.3" class="group flex">
+ <h2 title="glm-5.3"><span >glm-5.3</span></h2>
+ <p class="mt-1" title="A flagship model.">A flagship model.</p>
+ <div><span class="group/tip"><span role="tooltip">Runs on Ollama&#39;s cloud</span>
+ <span class="font-medium">Cloud</span></span>
+ <span class="inline-flex"><svg aria-hidden="true"><path d="M1"/></svg>Tools</span>
+ <span class="inline-flex"><svg aria-hidden="true"><path d="M1"/></svg>Thinking</span></div>
+</a></li>
+</ul>
+"""
+
+
+def test_search_parser_reads_the_redesigned_listing() -> None:
+ embedding, cloud = library.parse_search_html(_REDESIGNED_ENTRIES)
+
+ assert embedding["name"] == "embeddinggemma-2"
+ assert embedding["description"] == "An embedding model."
+ assert embedding["capabilities"] == ["vision", "embedding"]
+ assert embedding["cloud"] is False
+ assert embedding["sizes"] == ["270m", "440m"]
+ assert embedding["pulls"] == "5,435"
+ assert embedding["updated"] == ""
+
+ assert cloud["name"] == "glm-5.3"
+ assert cloud["capabilities"] == ["tools", "thinking"]
+ assert cloud["cloud"] is True
+ assert cloud["pulls"] == ""
+
+
def test_search_parser_reads_icon_badges_and_download_counts() -> None:
page = """
<li><a href="/library/example">