TST: Finish testing all examples

- py.test will now run examples/test_examples.py too
This commit is contained in:
Eric Dill 2015-07-12 12:19:18 -05:00
parent e33dd2b269
commit 6375c74109
4 changed files with 17 additions and 11 deletions

View File

@ -8,7 +8,7 @@ if __name__ == "__main__" and (__package__ is None or __package__==''):
import examples import examples
__package__ = "examples" __package__ = "examples"
from .utils import buildFileList, testFile, run, path from .utils import buildFileList, testFile, run, path, examples
if __name__ == '__main__': if __name__ == '__main__':

14
examples/test_examples.py Normal file
View File

@ -0,0 +1,14 @@
from __future__ import print_function, division, absolute_import
from pyqtgraph import Qt
from . import utils
files = utils.buildFileList(utils.examples)
import pytest
@pytest.mark.parametrize("f", files)
def test_examples(f):
# Test the examples with whatever the current QT_LIB front
# end is
utils.testFile(f[0], f[1], utils.sys.executable, Qt.QT_LIB)

View File

@ -1,8 +0,0 @@
from .__main__ import buildFileList, testFile, sys, examples
def test_pyside():
files = buildFileList(examples)
for f in files:
yield testFile, f[0], f[1], sys.executable, 'PySide'
# testFile(f[0], f[1], sys.executable, 'PySide')

View File

@ -208,7 +208,7 @@ def buildFileList(examples, files=None):
def testFile(name, f, exe, lib, graphicsSystem=None): def testFile(name, f, exe, lib, graphicsSystem=None):
global path global path
fn = os.path.join(path,f) fn = os.path.join(path,f)
#print "starting process: ", fn #print "starting process: ", fn
os.chdir(path) os.chdir(path)
sys.stdout.write(name) sys.stdout.write(name)
@ -235,7 +235,7 @@ except:
print("test failed") print("test failed")
raise raise
""" % (import1, graphicsSystem, import2) """ % (import1, graphicsSystem, import2)
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
process = subprocess.Popen([exe], stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE) process = subprocess.Popen([exe], stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)