fastai / nbdev_template

Template for nbdev projects
https://nbdev.fast.ai/
Apache License 2.0
291 stars 99 forks source link

Build Action - Incompatible with Pygame? #38

Closed gsilvers closed 3 years ago

gsilvers commented 3 years ago

Hi,

This may be more a question rather than a bug. I'm experimenting with this template and NBDEV and figured why not try Pygame. Jupyter can indeed pop open a Pygame window as expected but if you then try to push a notebook with such to this template the test step will fail:

error: No available video device

This makes sense and all since this is running on a. headless GitHub flow. Is there any way to skip cells when running CI only? I'm guessing this is user error on my part, this would likely fail on anything that cannot render within jupyter itself. This works fine on local its only when it pushes and attempts to build the docs that this error occurs.

Repro Steps:

screen = pygame.display.set_mode([500, 500])

If you want to repro easily you can just use my repo https://github.com/gsilvers/Underfoot. Fork it, make some tiny change and then push the change back up to trigger CI.

gsilvers commented 3 years ago

Closing this to future users incase the docs are not clear. If you have something you want to run local but not when CI runs you can create a tag in your settings.ini like so:


#Test flags: introduce here the test flags you want to use separated by |
tst_flags = tst_local_only

And then add that to your cell like:

#hide_output
#hide_input
#tst_local_only

import pygame

pygame.init()
screen = pygame.display.set_mode([500, 500])

And CI will skip that cell when testing. To test it local you can just run the cell in jupyter OR when you run nbdev_test_nbs pass it --flags= tst_local_only