From 2ef6395be2b6f9d2c29746176345d1bdf518df4f Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Fri, 23 Nov 2018 17:14:03 +0000 Subject: [PATCH] Added demonstration of test plugins --- tests/test_plugins.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/test_plugins.py diff --git a/tests/test_plugins.py b/tests/test_plugins.py new file mode 100644 index 00000000..469b3fa4 --- /dev/null +++ b/tests/test_plugins.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +from openflexure_microscope.camera.pi import StreamingCamera +from openflexure_stage import OpenFlexureStage +from openflexure_microscope import Microscope +from openflexure_microscope.plugins import PluginMount, load_plugin, search_plugin_dirs + +import atexit +import logging, sys +logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) + +if __name__ == '__main__': + microscope = Microscope(StreamingCamera(), OpenFlexureStage("/dev/ttyUSB0")) + + plugins_list = search_plugin_dirs([], include_default=True) + + for i in plugins_list: + module = load_plugin(i) + microscope.plugin.attach(module) + + # Check that default tets plugins have loaded + print("RUNNING PLUGIN METHODS:") + microscope.plugin.test1.run() + microscope.plugin.test2.run() + + microscope.close() \ No newline at end of file