TST: Finish testing all examples
- py.test will now run examples/test_examples.py too
This commit is contained in:
parent
e33dd2b269
commit
6375c74109
@ -8,7 +8,7 @@ if __name__ == "__main__" and (__package__ is None or __package__==''):
|
||||
import examples
|
||||
__package__ = "examples"
|
||||
|
||||
from .utils import buildFileList, testFile, run, path
|
||||
from .utils import buildFileList, testFile, run, path, examples
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
14
examples/test_examples.py
Normal file
14
examples/test_examples.py
Normal 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)
|
@ -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')
|
@ -208,7 +208,7 @@ def buildFileList(examples, files=None):
|
||||
|
||||
def testFile(name, f, exe, lib, graphicsSystem=None):
|
||||
global path
|
||||
fn = os.path.join(path,f)
|
||||
fn = os.path.join(path,f)
|
||||
#print "starting process: ", fn
|
||||
os.chdir(path)
|
||||
sys.stdout.write(name)
|
||||
@ -235,7 +235,7 @@ except:
|
||||
print("test failed")
|
||||
raise
|
||||
|
||||
""" % (import1, graphicsSystem, import2)
|
||||
""" % (import1, graphicsSystem, import2)
|
||||
|
||||
if sys.platform.startswith('win'):
|
||||
process = subprocess.Popen([exe], stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
|
Loading…
Reference in New Issue
Block a user