Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

fix(tests): stop module-level sys.exit from aborting the whole pytest session

Tobi | Nordaluxdb4b68c70a39
diff --git a/tests/test_gsc_pagination.py b/tests/test_gsc_pagination.py
index f59b311..421ac4a 100644
--- a/tests/test_gsc_pagination.py
+++ b/tests/test_gsc_pagination.py
@@ -6,9 +6,17 @@ import sys
from pathlib import Path
from unittest import mock
+import pytest
+
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
+# gsc_query calls sys.exit(1) at import time when google-api-python-client is
+# missing. Under pytest that SystemExit escapes collection as an INTERNALERROR
+# and aborts the whole session, so no test in tests/ runs. Skip this module
+# instead when the optional Google stack is absent.
+pytest.importorskip("googleapiclient")
+
import gsc_query # noqa: E402
diff --git a/tests/test_gsc_query.py b/tests/test_gsc_query.py
index f3075a6..57f93aa 100644
--- a/tests/test_gsc_query.py
+++ b/tests/test_gsc_query.py
@@ -6,11 +6,20 @@ import sys
from pathlib import Path
from unittest.mock import patch
+import pytest
+
+
REPO_ROOT = Path(__file__).resolve().parents[1]
_SCRIPTS = REPO_ROOT / "scripts"
if str(_SCRIPTS) not in sys.path:
sys.path.insert(0, str(_SCRIPTS))
+# gsc_query calls sys.exit(1) at import time when google-api-python-client is
+# missing. Under pytest that SystemExit escapes collection as an INTERNALERROR
+# and aborts the whole session, so no test in tests/ runs. Skip this module
+# instead when the optional Google stack is absent.
+pytest.importorskip("googleapiclient")
+
import gsc_query # noqa: E402
diff --git a/tests/test_gsc_totals_aggregate.py b/tests/test_gsc_totals_aggregate.py
index 996532c..fd72a15 100644
--- a/tests/test_gsc_totals_aggregate.py
+++ b/tests/test_gsc_totals_aggregate.py
@@ -9,9 +9,17 @@ import sys
from pathlib import Path
from unittest import mock
+import pytest
+
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
+# gsc_query calls sys.exit(1) at import time when google-api-python-client is
+# missing. Under pytest that SystemExit escapes collection as an INTERNALERROR
+# and aborts the whole session, so no test in tests/ runs. Skip this module
+# instead when the optional Google stack is absent.
+pytest.importorskip("googleapiclient")
+
import gsc_query # noqa: E402
diff --git a/tests/test_sitemap_discovery.py b/tests/test_sitemap_discovery.py
index 46018b4..0bf3319 100644
--- a/tests/test_sitemap_discovery.py
+++ b/tests/test_sitemap_discovery.py
@@ -6,9 +6,15 @@ import sys
from pathlib import Path
from unittest.mock import patch
+import pytest
+
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
+# sitemap_discovery imports lxml at module scope. Without it the collection
+# error interrupts the whole pytest session, so skip this module instead.
+pytest.importorskip("lxml")
+
import sitemap_discovery as discovery # noqa: E402
URLSET = b'<?xml version="1.0"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>'