Skip to content

Commit aa090b6

Browse files
test(crew): lock the documented public import surface (regression guard)
Executes 'from smallestai.atoms.crew import AtomsCrewApp, CrewSession, ...' so the exact ImportError a customer hit can't silently come back. Lives in tests/custom (fernignored), runs in the SDK test CI.
1 parent dc2f65c commit aa090b6

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"""Guards the documented public import surface of `smallestai.atoms.crew`.
2+
3+
A customer hit `ImportError` on `from smallestai.atoms.crew import AtomsCrewApp`
4+
because `crew/__init__` exported nothing (the imports there lived only in the
5+
docstring). Both the module docstring and the docs advertise this short path, so
6+
lock it here: if the package stops exporting a public symbol, this test fails in
7+
CI rather than in a customer's notebook.
8+
"""
9+
10+
import importlib
11+
12+
CREW_PUBLIC = [
13+
"AtomsCrewApp",
14+
"CrewSession",
15+
"OutputCrewNode",
16+
"BackgroundCrewNode",
17+
"OpenAIClient",
18+
"function_tool",
19+
"ToolRegistry",
20+
]
21+
22+
23+
def test_crew_all_advertises_public_api():
24+
mod = importlib.import_module("smallestai.atoms.crew")
25+
assert set(CREW_PUBLIC) <= set(mod.__all__)
26+
27+
28+
def test_crew_public_symbols_resolve_from_short_path():
29+
from smallestai.atoms.crew import ( # noqa: F401
30+
AtomsCrewApp,
31+
BackgroundCrewNode,
32+
CrewSession,
33+
OpenAIClient,
34+
OutputCrewNode,
35+
ToolRegistry,
36+
function_tool,
37+
)
38+
39+
for sym in (
40+
AtomsCrewApp,
41+
CrewSession,
42+
OutputCrewNode,
43+
BackgroundCrewNode,
44+
OpenAIClient,
45+
ToolRegistry,
46+
function_tool,
47+
):
48+
assert sym is not None
49+
50+
51+
def test_unknown_attr_raises_attributeerror():
52+
mod = importlib.import_module("smallestai.atoms.crew")
53+
try:
54+
mod.DefinitelyNotAThing
55+
except AttributeError:
56+
return
57+
raise AssertionError("expected AttributeError for an unknown attribute")

0 commit comments

Comments
 (0)