Test for command line execution

My notebooks render a GUI (OpenAI gym) when they run normally.

However, would like to avoid the GUIs running when I run nbdev_test_nbs.

Is there a flag I can set to test the notebook is running from the command line within nbdev_test_nbs?

If you had tst_flags=gui in settings.ini, marking cells that render a GUI with #gui should work.
See: https://nbdev.fast.ai/test.html

Running nbdev_test_nbs will run all tests except for the calls marked with #gui.
Running nbdev_test_nbs --flags=gui will run all tests including calls marked with #gui.

1 Like