streamlined approach to creating smoke tests by executing noteboks "as is" from the tests and asserting on values of local notebook vars #1233
slayoo
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@claresinger @edejong-caltech @abulenok @AgnieszkaMakulska
We've introduced a new utility that will likely make it easier to accompany notebooks with smoke tests. It's a function called
notebook_vars
that executes a given notebook and returns a dictionary mapping notebook variables to their values at the end of notebook execution: https://open-atmos.github.io/PySDM/PySDM_examples/utils/notebook_vars.htmlHere's an new test using this approach just contributed by @bhiogade (https://github.com/open-atmos/PySDM/blob/main/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py):
As exemplified above, the new tool automagically handles the
![image](https://private-user-images.githubusercontent.com/89685/296502523-e19380f6-9843-442f-9180-462a08a548fc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTMwNTYsIm5iZiI6MTczOTM1Mjc1NiwicGF0aCI6Ii84OTY4NS8yOTY1MDI1MjMtZTE5MzgwZjYtOTg0My00NDJmLTkxODAtNDYyYTA4YTU0OGZjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDA5MzIzNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI2NWYxMzhiMDM5YTAxNTc0OGJiNjZiYmFmMmEzZWY0MmRjZWVkYmExM2NlZDMxMTc3YzY4YzNjNDg5ZWM4YWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KEBIM6seFVOCOqxc-cg033pcl-L8Mt1TsjHEFQ8eV9s)
plot
flag, so debugging the failing tests one can easily turn plotting on, getting all the notebook plots, without ever starting Jupyter. The relevant notebook looks like this:Beta Was this translation helpful? Give feedback.
All reactions