[PR #2893] [MERGED] automate tests #2980

Closed
opened 2026-06-05 18:20:35 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/2893
Author: @npentrel
Created: 3/3/2026
Status: Merged
Merged: 3/4/2026
Merged by: @npentrel

Base: mainHead: automate-tests


📝 Commits (8)

📊 Changes

20 files changed (+1864 additions, -1 deletions)

View changed files

.deepagents/skills/docs-code-samples/SKILL.md (+210 -0)
.github/workflows/test-code-samples.yml (+106 -0)
📝 .gitignore (+3 -0)
📝 Makefile (+17 -1)
scripts/generate_code_snippet_mdx.py (+41 -0)
scripts/test_code_samples.py (+160 -0)
src/code-samples/langchain/return-a-string.py (+18 -0)
src/code-samples/langchain/return-a-string.ts (+23 -0)
src/code-samples/langchain/tool-return-command.py (+46 -0)
src/code-samples/langchain/tool-return-command.ts (+49 -0)
src/code-samples/langchain/tool-return-object.py (+26 -0)
src/code-samples/langchain/tool-return-object.ts (+32 -0)
src/code-samples/package-lock.json (+1018 -0)
src/code-samples/package.json (+19 -0)
src/snippets/code-samples/tool-return-command-js.mdx (+26 -0)
src/snippets/code-samples/tool-return-command-py.mdx (+21 -0)
src/snippets/code-samples/tool-return-object-js.mdx (+17 -0)
src/snippets/code-samples/tool-return-object-py.mdx (+13 -0)
src/snippets/code-samples/tool-return-values-js.mdx (+10 -0)
src/snippets/code-samples/tool-return-values-py.mdx (+9 -0)

📄 Description

Adds a workflow for migrating inline code samples from docs into standalone, testable source files, plus CI to automatically run those samples.

Changes

Code samples and test infrastructure

  • Runnable code samples - the first few in src/code-samples/langchain/ for tools docs:
    • return-a-string.py / return-a-string.ts — tool returning a string
    • tool-return-object.py / tool-return-object.ts — tool returning an object
    • tool-return-command.py / tool-return-command.ts — tool returning a Command
  • Test script (scripts/test_code_samples.py): Runs Python and TypeScript samples and reports pass/fail
  • Makefile targets: make test-code-samples (all) or make test-code-samples FILES="path1 path2" (specific files)
  • Bluehawk integration: make code-snippets extracts snippets and generates MDX for docs
  • Skill (.deepagents/skills/docs-code-samples/SKILL.md) documenting the migration workflow, will be used automatically when starting deepagents in the docs repeo.
  • src/code-samples-generated/ added to .gitignore

CI (GitHub Actions)

  • test-code-samples workflow that:
    • Runs on PRs that touch src/code-samples/**
    • Runs weekly (Sundays 00:00 UTC) to test all samples
    • On PR/push: tests only modified .py and .ts files
    • On schedule: tests all samples
    • Fails the workflow if any sample fails

How to use

  • Test all samples: make test-code-samples
  • Test specific samples: make test-code-samples FILES="src/code-samples/langchain/return-a-string.py"
  • Extract snippets for docs: make code-snippets

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/2893 **Author:** [@npentrel](https://github.com/npentrel) **Created:** 3/3/2026 **Status:** ✅ Merged **Merged:** 3/4/2026 **Merged by:** [@npentrel](https://github.com/npentrel) **Base:** `main` ← **Head:** `automate-tests` --- ### 📝 Commits (8) - [`d64318f`](https://github.com/langchain-ai/docs/commit/d64318fc5de8b54fc8d8f3e530bd6dc5acd9ea06) add code samples for testing - [`e26c108`](https://github.com/langchain-ai/docs/commit/e26c108de7c0e22dd489c354d63a53d957bd8b8a) Add automated tests - [`b283f59`](https://github.com/langchain-ai/docs/commit/b283f591a8bac5eb8aa9e42e18513bfc5acc8bb6) update github action - [`035f764`](https://github.com/langchain-ai/docs/commit/035f764e724b4028fb1b37c408f913aec71f8cd4) format - [`7fcce98`](https://github.com/langchain-ai/docs/commit/7fcce987c5f27d8dd65e4b9e215695a6d523685c) fix - [`79af940`](https://github.com/langchain-ai/docs/commit/79af940782f9ff10efc867074d57fbb589e08735) update lint - [`ed987c1`](https://github.com/langchain-ai/docs/commit/ed987c1db6784db71d0a9e0eb5caf55dbd9a6907) fix - [`a255e37`](https://github.com/langchain-ai/docs/commit/a255e372424f472a85160de6d4f657dfff0d4b35) update skill to run linter ### 📊 Changes **20 files changed** (+1864 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `.deepagents/skills/docs-code-samples/SKILL.md` (+210 -0) ➕ `.github/workflows/test-code-samples.yml` (+106 -0) 📝 `.gitignore` (+3 -0) 📝 `Makefile` (+17 -1) ➕ `scripts/generate_code_snippet_mdx.py` (+41 -0) ➕ `scripts/test_code_samples.py` (+160 -0) ➕ `src/code-samples/langchain/return-a-string.py` (+18 -0) ➕ `src/code-samples/langchain/return-a-string.ts` (+23 -0) ➕ `src/code-samples/langchain/tool-return-command.py` (+46 -0) ➕ `src/code-samples/langchain/tool-return-command.ts` (+49 -0) ➕ `src/code-samples/langchain/tool-return-object.py` (+26 -0) ➕ `src/code-samples/langchain/tool-return-object.ts` (+32 -0) ➕ `src/code-samples/package-lock.json` (+1018 -0) ➕ `src/code-samples/package.json` (+19 -0) ➕ `src/snippets/code-samples/tool-return-command-js.mdx` (+26 -0) ➕ `src/snippets/code-samples/tool-return-command-py.mdx` (+21 -0) ➕ `src/snippets/code-samples/tool-return-object-js.mdx` (+17 -0) ➕ `src/snippets/code-samples/tool-return-object-py.mdx` (+13 -0) ➕ `src/snippets/code-samples/tool-return-values-js.mdx` (+10 -0) ➕ `src/snippets/code-samples/tool-return-values-py.mdx` (+9 -0) </details> ### 📄 Description Adds a workflow for migrating inline code samples from docs into standalone, testable source files, plus CI to automatically run those samples. ## Changes ### Code samples and test infrastructure - **Runnable code samples** - the first few in `src/code-samples/langchain/` for tools docs: - `return-a-string.py` / `return-a-string.ts` — tool returning a string - `tool-return-object.py` / `tool-return-object.ts` — tool returning an object - `tool-return-command.py` / `tool-return-command.ts` — tool returning a Command - **Test script** (`scripts/test_code_samples.py`): Runs Python and TypeScript samples and reports pass/fail - **Makefile targets**: `make test-code-samples` (all) or `make test-code-samples FILES="path1 path2"` (specific files) - **Bluehawk integration**: `make code-snippets` extracts snippets and generates MDX for docs - **Skill** (`.deepagents/skills/docs-code-samples/SKILL.md`) documenting the migration workflow, will be used automatically when starting deepagents in the docs repeo. - **`src/code-samples-generated/`** added to `.gitignore` ### CI (GitHub Actions) - **`test-code-samples` workflow** that: - Runs on PRs that touch `src/code-samples/**` - Runs weekly (Sundays 00:00 UTC) to test all samples - On PR/push: tests only modified `.py` and `.ts` files - On schedule: tests all samples - Fails the workflow if any sample fails --- ## How to use - **Test all samples:** `make test-code-samples` - **Test specific samples:** `make test-code-samples FILES="src/code-samples/langchain/return-a-string.py"` - **Extract snippets for docs:** `make code-snippets` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:20:35 -04:00
yindo closed this issue 2026-06-05 18:20:35 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2980