diff --git a/backend/danswer/connectors/mediawiki/family.py b/backend/danswer/connectors/mediawiki/family.py index 163bca2ef6b..7554dd0f3cd 100644 --- a/backend/danswer/connectors/mediawiki/family.py +++ b/backend/danswer/connectors/mediawiki/family.py @@ -3,6 +3,7 @@ import builtins import functools import itertools +import tempfile from typing import Any from unittest import mock from urllib.parse import urlparse @@ -18,6 +19,8 @@ logger = setup_logger() +pywikibot.config.base_dir = tempfile.TemporaryDirectory().name + @mock.patch.object( builtins, "print", lambda *args: logger.info("\t".join(map(str, args))) diff --git a/backend/danswer/connectors/mediawiki/wiki.py b/backend/danswer/connectors/mediawiki/wiki.py index 8a09fd6d500..27edea871dc 100644 --- a/backend/danswer/connectors/mediawiki/wiki.py +++ b/backend/danswer/connectors/mediawiki/wiki.py @@ -2,6 +2,7 @@ import datetime import itertools +import tempfile from collections.abc import Generator from collections.abc import Iterator from typing import Any @@ -25,6 +26,8 @@ logger = setup_logger() +pywikibot.config.base_dir = tempfile.TemporaryDirectory().name + def pywikibot_timestamp_to_utc_datetime( timestamp: pywikibot.time.Timestamp, @@ -121,7 +124,6 @@ def __init__( self.batch_size = batch_size # short names can only have ascii letters and digits - self.family = family_class_dispatch(hostname, "WikipediaConnector")() self.site = pywikibot.Site(fam=self.family, code=language_code) self.categories = [ diff --git a/backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py b/backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py index 9aaacfc1eae..6a1d3cd9111 100644 --- a/backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py +++ b/backend/tests/unit/danswer/connectors/mediawiki/test_wiki.py @@ -1,6 +1,7 @@ from __future__ import annotations import datetime +import tempfile from collections.abc import Iterable import pytest @@ -9,6 +10,8 @@ from danswer.connectors.mediawiki import wiki +pywikibot.config.base_dir = tempfile.TemporaryDirectory().name + @pytest.fixture def site() -> pywikibot.Site: diff --git a/backend/throttle.ctrl b/backend/throttle.ctrl deleted file mode 100644 index e69de29bb2d..00000000000