Skip to content

Commit 42b5357

Browse files
committed
Add search to docs, test using __future__.annotations
1 parent d539e09 commit 42b5357

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ edit_uri: edit/main/docs/
4444

4545

4646
plugins:
47+
- search
4748
- mkdocstrings:
4849
handlers:
4950
python:

test/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
from __future__ import annotations
2+
13
import abc
24
import asyncio
35
import dataclasses
46
import io
7+
import re
58
import sys
69
from io import StringIO
710
from pathlib import Path
@@ -329,6 +332,13 @@ class Complex:
329332
foo: int
330333
bar: str
331334

335+
# Insert classes into the global namespace, needed because we test with `from __future__ import annotations`
336+
# From https://stackoverflow.com/a/69034361:
337+
# For the uncommon case of classes defined in a locals scope one has to explicitly provide the namespace.
338+
for local_name, local_item in locals().items():
339+
if re.match("^[A-Z]", local_name):
340+
globals()[local_name] = local_item
341+
332342
@arguably.command
333343
def log(message: str = "Howdy, there!", *, logger: Annotated[Logger, arguably.arg.builder()] = NoLogger()) -> None:
334344
"""

0 commit comments

Comments
 (0)