changeset 62:61701d895082

Check for test plugin existence and version
author Chris Cannam
date Wed, 14 Jan 2015 10:55:45 +0000
parents f7ee26ca5304
children 34fc48e2df7e
files .hgignore Makefile.inc test/test_plugin_metadata.py
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Jan 14 10:36:55 2015 +0000
+++ b/.hgignore	Wed Jan 14 10:55:45 2015 +0000
@@ -7,3 +7,4 @@
 *.pyc
 *.bak
 *.orig
+.tests
--- a/Makefile.inc	Wed Jan 14 10:36:55 2015 +0000
+++ b/Makefile.inc	Wed Jan 14 10:55:45 2015 +0000
@@ -8,13 +8,19 @@
 
 HEADERS		:= $(SRC_DIR)/PyPluginObject.h $(SRC_DIR)/PyRealTime.h $(SRC_DIR)/FloatConversion.h $(SRC_DIR)/VectorConversion.h
 SOURCES		:= $(SRC_DIR)/PyPluginObject.cpp $(SRC_DIR)/PyRealTime.cpp $(SRC_DIR)/VectorConversion.cpp $(SRC_DIR)/vampyhost.cpp
+TESTS		:= $(wildcard test/test_*.py)
 
 OBJECTS		:= $(SOURCES:.cpp=.o)
 OBJECTS		:= $(OBJECTS:.c=.o)
 
+all:		$(LIBRARY) .tests
+
 $(LIBRARY):	$(OBJECTS)
 		$(CXX) -o $@ $^ $(LDFLAGS)
+
+.tests:		$(LIBRARY) $(TESTS)
 		$(NOSE)
+		@touch $@
 
 clean:		
 		rm -f $(OBJECTS)
--- a/test/test_plugin_metadata.py	Wed Jan 14 10:36:55 2015 +0000
+++ b/test/test_plugin_metadata.py	Wed Jan 14 10:55:45 2015 +0000
@@ -5,9 +5,19 @@
 
 rate = 44100
 
+expectedVersion = 3
+
+def test_plugin_exists():
+    assert testPluginKey in vh.listPlugins()
+    plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone)
+    assert "pluginVersion" in plug.info
+    if plug.info["pluginVersion"] != expectedVersion:
+        print("Test plugin version " + str(plug.info["pluginVersion"]) + " does not match expected version " + str(expectedVersion))
+    assert plug.info["pluginVersion"] == expectedVersion
+
 def test_getoutputlist():
     outputs = vh.getOutputsOf(testPluginKey)
-    assert len(outputs) == 9
+    assert len(outputs) == 10
     assert "input-summary" in outputs
 
 def test_inputdomain():