modal-labs / pytest-markdown-docs

Run pytest on markdown code fence blocks
MIT License
46 stars 6 forks source link

Add support for specifying metadata options in MDX comments #29

Open bunchesofdonald opened 2 weeks ago

bunchesofdonald commented 2 weeks ago

Summary

This PR adds support for specifying test metadata in .mdx files using MDX-style comments ({/* pmd-metadata: */}) placed above code blocks. This should support all existing options and allow for easily adding more without having to alter the MDX parsing logic.

Example:

{/* pmd-metadata: notest, fixture:capsys */}
```python
print("hello")
captured = capsys.readouterr()
assert captured.out == "hello\n"

Issue: https://github.com/modal-labs/pytest-markdown-docs/issues/28