# doctest text file >>> import os, os.path, sys >>> cwd = os.getcwd() # run non-gui example scripts, check they run and produce no output (error messages) # and exit successfully >>> _dir = os.path.join(cwd, '..', 'examples') >>> os.chdir (_dir) >>> files = [f for f in os.listdir('.') if f.endswith('.py')] >>> for f in files: ... ret = os.system ('python %s' % f) # return value is system dependent ... if ret != 0 and sys.platform.startswith('linux'): ... print 'Error:', f, 'returned', ret # run png snippets >>> cmd = 'python snippets_png.py -s' >>> _dir = os.path.join(cwd, '..', 'examples', 'cairo_snippets') >>> os.chdir (_dir) >>> ret = os.system (cmd) >>> if ret != 0 and sys.platform.startswith('linux'): ... print 'Error:', cmd, 'returned', ret