From 26bd4e2a3f74589510d83ddb06ca5b72d1786c6d Mon Sep 17 00:00:00 2001 From: arc53-machine <232052973+arc53-machine@users.noreply.github.com> Date: Tue, 29 Sep 2026 15:09:50 +0100 Subject: [PATCH] Keep the GitHub loader tests off the network With GITHUB_ACCESS_TOKEN set in the environment, load_data checked the repository's visibility against the real GitHub API. The tests now clear the instance token unless they set one. --- tests/parser/remote/test_github_loader.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/parser/remote/test_github_loader.py b/tests/parser/remote/test_github_loader.py index 5d60d77a..7dcb7756 100644 --- a/tests/parser/remote/test_github_loader.py +++ b/tests/parser/remote/test_github_loader.py @@ -6,6 +6,16 @@ import requests from docsgpt.parser.remote.github_loader import GitHubLoader +@pytest.fixture(autouse=True) +def _no_instance_token(monkeypatch): + """No ``GITHUB_ACCESS_TOKEN`` from the environment: with one, ``load_data`` + checks the repository's visibility against the real GitHub API. Tests that + need the instance token set it themselves.""" + from docsgpt.core.settings import settings + + monkeypatch.setattr(settings, "GITHUB_ACCESS_TOKEN", None) + + def make_response(json_data=None, status_code=200, raise_error=None): resp = MagicMock() resp.status_code = status_code