summaryrefslogtreecommitdiff
path: root/tests/test_search.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-02 15:02:25 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-02 17:40:38 +0000
commit087522cf79b5e998c1e7b7350783accf328fecd1 (patch)
tree223554188176c5171804bce1f6bcc7188b866988 /tests/test_search.py
parent4c44f220090b5f69ec4f6f7a76924c1c1d19f0f8 (diff)
downloadsphinx-git-087522cf79b5e998c1e7b7350783accf328fecd1.tar.gz
Rewrite IndexBuilder loading
Diffstat (limited to 'tests/test_search.py')
-rw-r--r--tests/test_search.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_search.py b/tests/test_search.py
index c47c6c695..0fafa2975 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -11,7 +11,12 @@ from docutils.parsers import rst
from sphinx.search import IndexBuilder
-DummyEnvironment = namedtuple('DummyEnvironment', ['version', 'domains'])
+
+class DummyEnvironment(namedtuple('DummyEnvironment', ['version', 'domains'])):
+ def __getattr__(self, name):
+ if name.startswith('_search_index_'):
+ setattr(self, name, {})
+ return getattr(self, name, {})
class DummyDomain:
@@ -185,6 +190,8 @@ def test_IndexBuilder():
assert index._objnames == {0: ('dummy1', 'objtype1', 'objtype1'),
1: ('dummy2', 'objtype1', 'objtype1')}
+ env = DummyEnvironment('1.0', {'dummy1': domain1, 'dummy2': domain2})
+
# dump / load
stream = BytesIO()
index.dump(stream, 'pickle')