Skip to content

Commit 9a44d35

Browse files
robtaylorclaude
andcommitted
Add doctest infrastructure and fix failing test
Phase 1 & 2 of doctest improvements: - Fix import path in chipflow-toml-guide.rst doctest (_parse_config_file from config.parser) - Add doctest_global_setup in conf.py with common imports for test examples - Existing doctest now passes The global setup imports common modules (Amaranth, ChipFlow signatures) so that doctests can focus on demonstrating API usage without repetitive imports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b568bf8 commit 9a44d35

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/chipflow-toml-guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Let's start with a typical example:
1414
# Assert that example-chipflow.toml matches the current config schema. If
1515
# this test fails, then its likely that the content in this file will need
1616
# to be updated.
17-
from chipflow_lib.config import _parse_config_file
17+
from chipflow_lib.config.parser import _parse_config_file
1818
_parse_config_file("docs/example-chipflow.toml")
1919

2020
``[chipflow]`` table

docs/conf.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,20 @@
108108
("Members", "params_style"), # `amaranth.lib.wiring` signature members
109109
]
110110

111+
# Doctest configuration
112+
doctest_global_setup = """
113+
from pathlib import Path
114+
from amaranth import Module
115+
from amaranth.lib import wiring
116+
from amaranth.lib.wiring import In, Out, connect, flipped
117+
from amaranth_soc import csr, wishbone
118+
from chipflow_lib.platforms import (
119+
UARTSignature, GPIOSignature, SPISignature, I2CSignature,
120+
QSPIFlashSignature, JTAGSignature,
121+
IOTripPoint, Sky130DriveMode,
122+
SoftwareDriverSignature, attach_data, SoftwareBuild
123+
)
124+
"""
111125

112126
rst_prolog = """
113127
.. role:: py(code)

0 commit comments

Comments
 (0)