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

Tutorial Examples as Unit Tests #8

Open
martintb opened this issue Apr 19, 2018 · 3 comments
Open

Tutorial Examples as Unit Tests #8

martintb opened this issue Apr 19, 2018 · 3 comments

Comments

@martintb
Copy link
Collaborator

All of the examples in the tutorial should also be written to be unit tests. Since we already have the data extracted and pyPRISM scripts written (in the tutorial), this should not be difficult.

In general, adding full pyPRISM calculations for various systems as unit tests would be great for checking for regression when adding new features.

@HaroldHatchNIST
Copy link
Member

HaroldHatchNIST commented May 10, 2018

I tried this in feasst but it is suboptimal and would be interested to see how you implement it. Currently I use a shell script to aggregate them and strip out some parts of the tutorial (in feasst they are called "testcases" and the nasty shell script is lines 11-20 of https://github.com/usnistgov/feasst/blob/master/tools/build/genGTestCases.sh). One problem I have is I either forget to set up the "tutorial" as a unittest and then when it fails I have to work to hunt it down; or if I set them up at unittests they look ugly to new users of the tutorial (e.g. extra unittest boiler plate..)

@martintb
Copy link
Collaborator Author

Hmmmm. I was more or less thinking of doing the same (manually copy tutorial examples from the Jupyter notebooks). From a maintainability point of view, this is obviously a not a idea.

It would be nice if the tutorial examples were automatically transferable as unit-tests. I believe that FiPy achieves this via doctest. Unfortunately, as my tutorial is in multiple Jupyter notebooks, I don't believe I can make use of doctest.

Let me know if you have other ideas and I'll do the same! I am primarily motivated to include tutorial examples as tests because one of my examples fails on certain machines and we have yet to figure out why. It would be much easier to detect this if the example was in the test-suite.

@HaroldHatchNIST
Copy link
Member

I hadn't seen doctest before. That could work well for me. Thanks!

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

No branches or pull requests

2 participants