pyqtgraph/examples/test_examples.py

33 lines
1000 B
Python
Raw Normal View History

from __future__ import print_function, division, absolute_import
from pyqtgraph import Qt
2015-07-12 20:45:39 +00:00
from examples import utils
import importlib
import itertools
import pytest
files = utils.buildFileList(utils.examples)
2015-07-12 20:45:39 +00:00
frontends = {Qt.PYQT4: False, Qt.PYSIDE: False}
# frontends = {Qt.PYQT4: False, Qt.PYQT5: False, Qt.PYSIDE: False}
2015-07-12 20:45:39 +00:00
# sort out which of the front ends are available
for frontend in frontends.keys():
try:
importlib.import_module(frontend)
frontends[frontend] = True
except ImportError:
pass
2015-07-12 20:45:39 +00:00
@pytest.mark.parametrize(
"frontend, f", itertools.product(sorted(list(frontends.keys())), files))
def test_examples(frontend, f):
# Test the examples with all available front-ends
2015-07-12 20:45:39 +00:00
print('frontend = %s. f = %s' % (frontend, f))
if not frontends[frontend]:
pytest.skip('{} is not installed. Skipping tests'.format(frontend))
utils.testFile(f[0], f[1], utils.sys.executable, frontend)
if __name__ == "__main__":
pytest.cmdline.main()