From eec2203ad228b816f78a04425ffa204f6e4d36f4 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Fri, 14 Aug 2026 16:28:14 -0700 Subject: [PATCH 1/2] Delete documentation and package metadata tests Signed-off-by: David Gardner --- .../adapters/test_adapter_package_metadata.py | 196 ------------------ tests/python/test_readme_examples.py | 54 ----- 2 files changed, 250 deletions(-) delete mode 100644 tests/adapters/test_adapter_package_metadata.py delete mode 100644 tests/python/test_readme_examples.py diff --git a/tests/adapters/test_adapter_package_metadata.py b/tests/adapters/test_adapter_package_metadata.py deleted file mode 100644 index 0c78c7c91..000000000 --- a/tests/adapters/test_adapter_package_metadata.py +++ /dev/null @@ -1,196 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Guard the published adapter dependency boundary.""" - -from __future__ import annotations - -import tomllib -from pathlib import Path - -import pytest - -ROOT_DIR = Path(__file__).resolve().parents[2] - - -def load_pyproject(path: str) -> dict: - return tomllib.loads( - (ROOT_DIR / path / "pyproject.toml").read_text(encoding="utf-8") - ) - - -SDK_PACKAGE_PATH = "sdk/python/nemo-fabric" -PACKAGE_VERSION = load_pyproject(SDK_PACKAGE_PATH)["project"]["version"] -RUNTIME_DEPENDENCY = f"nemo-fabric-runtime == {PACKAGE_VERSION}" -RELAY_CLI_DEPENDENCY = "nemo-relay-cli-bin>=0.7.2,<0.8" - -ADAPTER_EXTRAS = { - "claude": { - "path": "adapters/claude", - "sdk": f"nemo-fabric-adapters-claude[harness] == {PACKAGE_VERSION}", - "harness": ["claude-agent-sdk==0.2.120", RELAY_CLI_DEPENDENCY], - }, - "codex": { - "path": "adapters/codex", - "sdk": f"nemo-fabric-adapters-codex[harness] == {PACKAGE_VERSION}", - "harness": ["openai-codex==0.144.4", RELAY_CLI_DEPENDENCY], - }, - "deepagents": { - "path": "adapters/deepagents", - "sdk": f"nemo-fabric-adapters-deepagents[harness] == {PACKAGE_VERSION}", - "harness": [ - "deepagents>=0.6.12,<0.7.0", - "langchain>=1.3,<2.0", - "langgraph>=1.2,<2.0", - ], - "relay": ["nemo-relay>=0.7.2,<0.8"], - "full_relay": ["nemo-relay[deepagents]>=0.7.2,<0.8"], - }, - "hermes-agent": { - "path": "adapters/hermes", - "sdk": ( - f"nemo-fabric-adapters-hermes == {PACKAGE_VERSION}; " - "python_version < '3.14'" - ), - "relay": ["nemo-relay>=0.7.2,<0.8"], - }, - "mini-swe-agent": { - "path": "adapters/mini-swe-agent", - "sdk": f"nemo-fabric-adapters-mini-swe-agent[harness] == {PACKAGE_VERSION}", - "harness": ["mini-swe-agent>=2.0,<3"], - }, -} - - -@pytest.mark.parametrize( - ("path", "expected"), - [ - ("adapter-contract/python", []), - ("adapters/common", []), - ( - "adapters/claude", - [ - f"nemo-fabric-adapter-contract == {PACKAGE_VERSION}", - f"nemo-fabric-adapters-common == {PACKAGE_VERSION}", - "tomli-w~=1.2", - ], - ), - ( - "adapters/codex", - [ - f"nemo-fabric-adapter-contract == {PACKAGE_VERSION}", - f"nemo-fabric-adapters-common == {PACKAGE_VERSION}", - "tomli-w~=1.2", - ], - ), - ( - "adapters/deepagents", - [ - f"nemo-fabric-adapter-contract == {PACKAGE_VERSION}", - f"nemo-fabric-adapters-common == {PACKAGE_VERSION}", - "langchain-mcp-adapters>=0.1,<0.3.0", - "langchain-openai>=0.3", - "langgraph-checkpoint-sqlite>=3.0,<4.0", - ], - ), - ( - "adapters/hermes", - [ - f"nemo-fabric-adapter-contract == {PACKAGE_VERSION}", - f"nemo-fabric-adapters-common == {PACKAGE_VERSION}", - ], - ), - ( - "adapters/mini-swe-agent", - [ - f"nemo-fabric-adapter-contract == {PACKAGE_VERSION}", - f"nemo-fabric-adapters-common == {PACKAGE_VERSION}", - ], - ), - ], -) -def test_adapter_runtime_dependencies(path: str, expected: list[str]): - project = load_pyproject(path)["project"] - assert project["version"] == PACKAGE_VERSION - assert sorted(project.get("dependencies", [])) == sorted(expected) - - -def test_adapter_contract_offers_optional_pydantic_interop(): - extras = load_pyproject("adapter-contract/python")["project"][ - "optional-dependencies" - ] - - assert extras == {"pydantic": ["pydantic>=2.12,<3"]} - - -def test_adapter_test_dependency_group_matches_leaf_harnesses(): - manifest = load_pyproject("") - expected = [ - "nemo-fabric-adapters-claude[harness]", - "nemo-fabric-adapters-codex[harness]", - "nemo-fabric-adapters-deepagents[harness]", - "nemo-fabric-adapters-hermes[full]; python_version < '3.14'", - "nemo-fabric-adapters-mini-swe-agent[harness]", - ] - assert sorted(manifest["dependency-groups"]["adapter-tests"]) == sorted(expected) - assert "adapter-tests" not in manifest["tool"]["uv"]["default-groups"] - - -def test_sdk_package_installs_runtime_unconditionally(): - manifest = load_pyproject(SDK_PACKAGE_PATH) - project = manifest["project"] - - assert project["dependencies"] == [RUNTIME_DEPENDENCY] - assert manifest["tool"]["setuptools"]["packages"] == [] - - -def test_root_project_is_a_private_development_coordinator(): - manifest = load_pyproject("") - - assert manifest["project"]["name"] == "nemo-fabric-development" - assert manifest["project"]["version"] == "0.0.0" - assert manifest["project"]["dependencies"] == ["nemo-fabric", RUNTIME_DEPENDENCY] - assert manifest["tool"]["uv"]["package"] is False - assert manifest["project"]["optional-dependencies"] == { - "claude": ["nemo-fabric[claude]"], - "codex": ["nemo-fabric[codex]"], - "deepagents": ["nemo-fabric[deepagents]"], - "mini-swe-agent": ["nemo-fabric[mini-swe-agent]"], - "harbor": ["nemo-fabric[harbor]"], - "hermes-agent": [ - "nemo-fabric[hermes-agent]; python_version < '3.14'" - ], - "relay": ["nemo-fabric[relay]"], - } - - -def test_sdk_relay_extra_installs_only_relay(): - extras = load_pyproject(SDK_PACKAGE_PATH)["project"]["optional-dependencies"] - assert extras["relay"] == ["nemo-relay>=0.7.2,<0.8"] - - -@pytest.mark.parametrize("name", ADAPTER_EXTRAS) -def test_sdk_adapter_extras_delegate_to_leaf_adapter_extras(name: str): - extras = load_pyproject(SDK_PACKAGE_PATH)["project"]["optional-dependencies"] - assert extras[name] == [ADAPTER_EXTRAS[name]["sdk"]] - assert set(extras) == set(ADAPTER_EXTRAS) | {"harbor", "relay"} - - -@pytest.mark.parametrize("name", ADAPTER_EXTRAS) -def test_leaf_adapter_extras_separate_harness_and_relay(name: str): - expected = ADAPTER_EXTRAS[name] - extras = load_pyproject(expected["path"])["project"]["optional-dependencies"] - relay = expected.get("relay", []) - full_relay = expected.get("full_relay", relay) - harness = expected.get("harness", []) - - assert sorted(extras["full"]) == sorted([*harness, *full_relay]) - - expected_names = {"full"} - if harness: - expected_names.add("harness") - assert extras["harness"] == harness - if relay: - expected_names.add("relay") - assert extras["relay"] == relay - assert set(extras) == expected_names diff --git a/tests/python/test_readme_examples.py b/tests/python/test_readme_examples.py deleted file mode 100644 index f475c0769..000000000 --- a/tests/python/test_readme_examples.py +++ /dev/null @@ -1,54 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Smoke test: the README quick start stays accurate and runnable.""" - -from __future__ import annotations - -from pathlib import Path - -from examples.code_review_agent import BASE_DIR, hermes_config -from nemo_fabric import Fabric - -ROOT = Path(__file__).resolve().parents[2] -README = ROOT / "README.md" - -# The README stays a quick start and routes detailed SDK usage to canonical docs. -DOCUMENTED_SNIPPETS = [ - "config = FabricConfig(", - "[`01_quickstart.ipynb` notebook](examples/notebooks/01_quickstart.ipynb)", - "[Python SDK guide](docs/sdk/python.mdx)", - 'pip install "nemo-fabric[hermes-agent]"', -] - -DETAILED_SDK_SNIPPETS = ( - "request = RunRequest(", - "### Multi-Turn SDK Runtimes", -) - - -def readme_documents_each_example() -> None: - """The README still contains every invocation this smoke mirrors.""" - - text = README.read_text(encoding="utf-8") - missing = [snippet for snippet in DOCUMENTED_SNIPPETS if snippet not in text] - assert not missing, f"README no longer documents these examples verbatim: {missing}" - duplicates = [snippet for snippet in DETAILED_SDK_SNIPPETS if snippet in text] - assert not duplicates, f"README duplicates detailed SDK guide examples: {duplicates}" - - -async def readme_python_examples_run() -> None: - """The README quick-start package remains resolvable and diagnosable.""" - - config = hermes_config() - client = Fabric() - plan = client.plan(config, base_dir=BASE_DIR) - report = await client.doctor(config, base_dir=BASE_DIR) - - assert plan["agent_name"] == "code-review-agent", plan["agent_name"] - assert report["checks"], "doctor returned no checks" - - -async def test_readme_examples(): - readme_documents_each_example() - await readme_python_examples_run() From 89cc1bc1068e52f091b1694f4901eefdeccfdad3 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Fri, 14 Aug 2026 16:28:53 -0700 Subject: [PATCH 2/2] Update skill instructing the agent to except docs, test helpers and packages Signed-off-by: David Gardner --- .agents/skills/python-tests/SKILL.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.agents/skills/python-tests/SKILL.md b/.agents/skills/python-tests/SKILL.md index 0141685ab..b35c620b2 100644 --- a/.agents/skills/python-tests/SKILL.md +++ b/.agents/skills/python-tests/SKILL.md @@ -36,21 +36,6 @@ license: Apache-2.0 ``` Simply allow the resulting KeyError to be raised if the "data" key is not present in the results dictionary, as this will provide a clear indication of what went wrong in the test. -## Packaging Metadata Tests - -When adapter installation metadata changes, assert the published composition -directly: - -- The root project unconditionally depends on the exact-version - `nemo-fabric-runtime` distribution. -- Each root harness extra delegates to the matching version of the leaf - adapter's `harness` extra. -- Bare leaf dependencies remain adapter-owned, and the root `adapter-tests` - dependency group installs each leaf through its `harness` extra. -- Every leaf provides `full`. Only adapters that import NeMo Relay Python APIs - provide `relay`; adapters that launch the Relay CLI install - `nemo-relay-cli-bin` through both `harness` and `full`. - ## Common Commands ```bash @@ -61,6 +46,12 @@ uv run pytest -k "" uv run pytest ``` +## Do Not Write Tests For + +- Documentation. +- Test helper code under `tests/_utils/`. +- Package metadata or wheel installation behavior. + ## References - `pyproject.toml`