Skip to content

Commit

Permalink
Add Tests To Demonstrate Issue #386
Browse files Browse the repository at this point in the history
  • Loading branch information
derks committed Nov 23, 2016
1 parent 34c4496 commit c838f1f
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/__data__/config/plugins.d/plugin1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[plugin1]
enable_plugin = 1
foo = bar
3 changes: 3 additions & 0 deletions tests/__data__/config/plugins.d/plugin2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[plugin2]
enable_plugin = 1
foo = bar
3 changes: 3 additions & 0 deletions tests/__data__/plugins/plugin1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

def load(app):
app.plugin1_loaded = True
5 changes: 5 additions & 0 deletions tests/__data__/plugins/plugin2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

from .foo import bar

def load(app):
app.plugin2_loaded = True
1 change: 1 addition & 0 deletions tests/__data__/plugins/plugin2/foo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bar = 1
29 changes: 29 additions & 0 deletions tests/ext/plugin_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Tests for cement.ext.ext_plugin."""

import os
from cement.utils import test
from cement.core.exc import FrameworkError
from cement.ext.ext_plugin import CementPluginHandler
from nose.plugins.attrib import attr

@attr('plugin')
class PluginExtTestCase(test.CementExtTestCase):

def setUp(self):
super(PluginExtTestCase, self).setUp()
self.app = self.make_app('tests',
argv=[],
plugin_dir='./tests/__data__/plugins',
plugin_config_dir='./tests/__data__/config/plugins.d'
)

def test_plugins(self):
# real simple tests here just to ensure different kinds of plugins
# are loading
with self.app as app:
app.run()
self.ok(app.plugin1_loaded)

### FIX ME: Fails because relative imports are broken with
### importlib (which deprecated imp)
self.ok(app.plugin2_loaded)

0 comments on commit c838f1f

Please sign in to comment.