Skip to content

Custom runners for non-Python code fences #67

Open
aaazzam wants to merge 7 commits into
mainfrom
add-custom-runners
Open

Custom runners for non-Python code fences #67
aaazzam wants to merge 7 commits into
mainfrom
add-custom-runners

Conversation

@aaazzam

@aaazzam aaazzam commented Jun 11, 2026

Copy link
Copy Markdown

This PR closes #66 by making custom runners usable for non-Python fences.

It does so by adding two opt-in paths:

  1. runner:<name> now collects any fence language with the named registered runner.
  2. register_runner(default_for=(...)) registers a runner as the default for specific fence languages.

Custom runners were always available a la (1) above, but only for python-based fences. Adding more opt-in paths of course adds marginal complexity to the runner selection precedence, which this PR makes:

  1. Explicit runner:<name> on the fence.
  2. A language match from default_for.
  3. The global default runner for built-in Python fences.
  4. Ignore the fence.

This PR enables us to do things like:

@register_runner(default_for=("js", "javascript"))
class JavascriptRunner(DefaultRunner):
    ...

which sets a global default for js and javascript fences

```js
expect(value).toBe(1)
```

while allowing per-fence customizeability

```js runner:OtherRunner
expect(value).toBe(1)
```

Also exposes all fence options (info-string options plus mdx-comment metadata) as an options: frozenset field on FenceTestDefinition, so custom runners can define their own per-fence flags without declaring a placeholder pytest fixture for each one.

aaazzam and others added 7 commits June 10, 2026 22:22
Custom runners previously had only fixture names as a per-fence metadata
channel, forcing consumers to declare placeholder pytest fixtures for
flags whose values are never used. Expose the full set of fence options
(info-string options plus mdx-comment metadata) as an `options`
frozenset on FenceTestDefinition so runners can define their own flags.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom runners for non-Python code fences

1 participant