Repository navigation
Add end-to-end test for a Jupyter REPL session - #106
Merged
Merged
Conversation
A stand-alone Markdown file, configured through its YAML header, tangles a module and uses it in a Jupyter session. The test tangles, runs the session, weaves with the `repl` filter and compares against expected Markdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
File systems with coarse timestamps (seen on Windows CI) can give a rewritten session output file the same mtime, so the `repl` filter used stale output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an end-to-end test of a REPL session with the Jupyter backend.
The input,
test/data/repl-jupyter/primes.md, is a stand-alone document with noentangled.toml. Its YAML header turns on thereplhook and sets Python to use the Jupyter backend. The document tangles aprimes.pymodule and then uses it in a session with three commands: one with a result, one that prints to stdout, and one with a Markdown result.The test (
test/integration/test_repl_jupyter.py):primes.pywas written;python3Jupyter kernel;-f repl;test/data/repl-jupyter/expected.mdexactly.Only
primes.mdis copied into the working directory. Without anentangled.toml, Entangled reads every*.mdfile, and that would includeexpected.md.The test is skipped when
ipykernelisn't installed. CI installs it, so it runs on all three platforms.Fix: stale session output
On Windows CI an existing test failed intermittently. The
replfilter cached decoded session output keyed on(path, mtime_ns), and a file rewritten in quick succession can keep the same mtime. The cache is now keyed on the file contents. A regression test reproduces the problem on any OS by resetting the mtime after a rewrite.🤖 Generated with Claude Code