You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be really cool!
Currently, nbdev_test does not produce any interpretable output, only lists the failing notebooks without the error message (like nbdev1 used to).
@tcapelle it’s supposed to print each error and corresponding cell source. I looked into the nb_helpers repo, in case that’s what you’re referring to, and the errors aren’t printed there because the RichLogger class reconfigures the root logger with level=logging.ERROR, and nbdev_test use warning which logs at level WARNING which is lower than ERROR
cc @hamelsmu@jph00 - maybe we want to change the way we print those errors?
Hi! I'm very interested in developing a plotting package using nbdev. However, most graphical testing plugins are for IDE development. Do you have any suggestion on graphical testing in notebooks?
Basically "graphical testing" ensures that our package continue to work in a consistent way. The plugin we are using is pytest-mpl, and here is a brief example on how to using this plugin.
One pitfall I've run into that may be worth addressing in such a guide: when I forget to export functions (or imports), tests will still pass because the non-exported stuff is loaded in the notebook. I guess putting some tests in a separate notebook would guard against this?
Message ID: ***@***.***>I'm not sure I fully understand your question/concern. If you run nbdev_prepare or nbdev_test it should test correctly, shouldn't it?
Message ID: ***@***.***>Oh sorry I understand what you're saying now. Yes that can be an issue, although if you're exporting something that you never actually use anywhere else, then hopefully it's not a big problem! ;)
Right, it is often caught in a test in a separate notebook if it is used elsewhere, but I won't always have exhaustive test coverage elsewhere if I think its tested in the source notebook. To be more specific about the way this has bit me, it's usually a private helper function or global variable defined in the module scope that I forget to #|export, not something that would be directly called from elsewhere.
Activity
tcapelle commentedon Sep 2, 2022
This would be really cool!
Currently,
nbdev_testdoes not produce any interpretable output, only lists the failing notebooks without the error message (like nbdev1 used to).seeM commentedon Sep 2, 2022
@tcapelle it’s supposed to print each error and corresponding cell source. I looked into the nb_helpers repo, in case that’s what you’re referring to, and the errors aren’t printed there because the
RichLoggerclass reconfigures the root logger withlevel=logging.ERROR, andnbdev_testusewarningwhich logs at level WARNING which is lower than ERRORcc @hamelsmu @jph00 - maybe we want to change the way we print those errors?
hamelsmu commentedon Sep 2, 2022
@seeM I thought maybe you set the logging level to error or were in the process of doing that? Or is that for something else?
seeM commentedon Sep 8, 2022
@tcapelle could you try again with latest master and see if
nbdev_testproduces interpretable output for you?seeM commentedon Sep 15, 2022
@hamelsmu do you think this is sufficiently covered in https://nbdev.fast.ai/tutorials/best_practices.html?
hamelsmu commentedon Sep 15, 2022
No I don't think so, I think we can talk a lot more about tests esp:
tcapelle commentedon Oct 4, 2022
Ohh missed this! thanks guys, and I actually figured this out :P
Jacobluke- commentedon Nov 14, 2022
Hi! I'm very interested in developing a plotting package using nbdev. However, most graphical testing plugins are for IDE development. Do you have any suggestion on graphical testing in notebooks?
seeM commentedon Nov 15, 2022
Sounds interesting @Jacobluke-! I'm not familiar with "graphical testing", could you please share some graphical testing plugins you've enjoyed using?
Jacobluke- commentedon Nov 15, 2022
Hi @seeM , thanks for your reply.
Basically "graphical testing" ensures that our package continue to work in a consistent way. The plugin we are using is pytest-mpl, and here is a brief example on how to using this plugin.
hugetim commentedon Feb 5, 2023
One pitfall I've run into that may be worth addressing in such a guide: when I forget to export functions (or imports), tests will still pass because the non-exported stuff is loaded in the notebook. I guess putting some tests in a separate notebook would guard against this?
jph00 commentedon Feb 5, 2023
jph00 commentedon Feb 5, 2023
hugetim commentedon Feb 5, 2023
Right, it is often caught in a test in a separate notebook if it is used elsewhere, but I won't always have exhaustive test coverage elsewhere if I think its tested in the source notebook. To be more specific about the way this has bit me, it's usually a private helper function or global variable defined in the module scope that I forget to
#|export, not something that would be directly called from elsewhere.