Bypass Matplotlib plotting on Travis CI

less than 1 minute read

It’s useful to not plot on Travis-CI in most cases, because Travis doesn’t have X11 desktop. Put self-test Pythoncode that plots AND the matplotlib import under this if statement:

import os

def test_myfun():
    if not 'TRAVIS' in os.environ or not os.environ['TRAVIS']:
        from matplotlib.pyplot import figure,show
        ... disabled plotting code on Travis CI


Leave a Comment