Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for doctest with hy. #1019

Open
2 tasks
rduplain opened this issue Jan 26, 2016 · 3 comments
Open
2 tasks

Support for doctest with hy. #1019

rduplain opened this issue Jan 26, 2016 · 3 comments
Labels

Comments

@rduplain
Copy link

rduplain commented Jan 26, 2016

This gist has my investigation in all things hy + doctest: how to do it, limitations, an idea for hy.contrib.doctest, and a starting point for a py.test plugin to collect and run .hy doctests in a project.

A patch to hy could:

  • Support the full Python doctest command-line program python -m hy.contrib.doctest FILE to run doctests in a specific module.
  • Add a section to the docs on how to use doctest with hy.

I can put this together. I'm interested in reactions and/or alternative approaches.

@gilch gilch mentioned this issue Apr 11, 2016
@gilch
Copy link
Member

gilch commented Apr 11, 2016

What would it take to adapt doctest to use a Hy repl instead of the Python one? The main reason you put tests in docstrings is to show examples of intended use. If the examples are in a different language it kind of defeats the purpose. You might as well just use normal unit tests.

@rduplain
Copy link
Author

The doctest module parses and runs examples, so it'd take re-implementing that.

The main reason you put tests in docstrings is to show examples of intended use.

+1

If the examples are in a different language it kind of defeats the purpose.

Not if you are calling your code from Python, not hy. It's still relevant to show Python-based examples.

@Kodiologist
Copy link
Member

This would be really nice to have, so we could automatically check that all our documentation examples are correct as part of running the test suite. But I don't want it badly enough to put in the considerable effort that I suspect will be required. I'm going to leave the issue open in the hope that some kind soul will be interested someday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants