summaryrefslogtreecommitdiff
path: root/test-plugins
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-02-22 17:23:04 +0000
committerLars Wirzenius <liw@liw.fi>2012-02-22 17:23:04 +0000
commit4560577fce7e64fdd393d9e54dac237f35e8a25f (patch)
tree11e364bc87e98cc236d24f843d72f8a49c22f5da /test-plugins
parentd9f7efcde37f8208b8679b5aae0f1d38875ccc73 (diff)
downloadcliapp-4560577fce7e64fdd393d9e54dac237f35e8a25f.tar.gz
Add a plugin system
This code was originally written separately, which is why there's no history of it in the cliapp version control repository. The code is derived from code I wrote for obnam.
Diffstat (limited to 'test-plugins')
-rw-r--r--test-plugins/aaa_hello_plugin.py8
-rw-r--r--test-plugins/hello_plugin.py15
-rw-r--r--test-plugins/oldhello_plugin.py9
-rw-r--r--test-plugins/wrongversion_plugin.py12
4 files changed, 44 insertions, 0 deletions
diff --git a/test-plugins/aaa_hello_plugin.py b/test-plugins/aaa_hello_plugin.py
new file mode 100644
index 0000000..b8f3253
--- /dev/null
+++ b/test-plugins/aaa_hello_plugin.py
@@ -0,0 +1,8 @@
+import cliapp
+
+class Hello(cliapp.Plugin):
+
+ def __init__(self, foo, bar=None):
+ self.foo = foo
+ self.bar = bar
+
diff --git a/test-plugins/hello_plugin.py b/test-plugins/hello_plugin.py
new file mode 100644
index 0000000..1a4f1ea
--- /dev/null
+++ b/test-plugins/hello_plugin.py
@@ -0,0 +1,15 @@
+import cliapp
+
+class Hello(cliapp.Plugin):
+
+ def __init__(self, foo, bar=None):
+ self.foo = foo
+ self.bar = bar
+
+ @property
+ def version(self):
+ return '0.0.1'
+
+ def setup(self):
+ self.setup_called = True
+
diff --git a/test-plugins/oldhello_plugin.py b/test-plugins/oldhello_plugin.py
new file mode 100644
index 0000000..e401ff7
--- /dev/null
+++ b/test-plugins/oldhello_plugin.py
@@ -0,0 +1,9 @@
+import cliapp
+
+class Hello(cliapp.Plugin):
+
+ def __init__(self, foo, bar=None):
+ self.foo = foo
+ self.bar = bar
+
+
diff --git a/test-plugins/wrongversion_plugin.py b/test-plugins/wrongversion_plugin.py
new file mode 100644
index 0000000..9f54908
--- /dev/null
+++ b/test-plugins/wrongversion_plugin.py
@@ -0,0 +1,12 @@
+# This is a test plugin that requires a newer application version than
+# what the test harness specifies.
+
+import cliapp
+
+class WrongVersion(cliapp.Plugin):
+
+ required_application_version = '9999.9.9'
+
+ def __init__(self, *args, **kwargs):
+ pass
+