← Back to team overview

nagios-charmers team mailing list archive

[Merge] ~xavpaice/hw-health-charm:fix_tests into hw-health-charm:master

 

Xav Paice has proposed merging ~xavpaice/hw-health-charm:fix_tests into hw-health-charm:master.

Requested reviews:
  Nagios Charm developers (nagios-charmers)

For more details, see:
https://code.launchpad.net/~xavpaice/hw-health-charm/+git/hw-health-charm/+merge/363758
-- 
Your team Nagios Charm developers is requested to review the proposed merge of ~xavpaice/hw-health-charm:fix_tests into hw-health-charm:master.
diff --git a/Makefile b/Makefile
index d1043f4..89cd0ce 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ help:
 
 lint:
 	@echo "Running flake8"
-	@flake8 --max-line-length=80 ./src
+	@flake8 --max-line-length=120 ./src
 
 test: unittest lint
 
diff --git a/src/__init__.py b/src/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/__init__.py
diff --git a/src/actions/actions.py b/src/actions/actions.py
index 417b238..7b2031a 100755
--- a/src/actions/actions.py
+++ b/src/actions/actions.py
@@ -19,9 +19,9 @@ import subprocess
 import sys
 sys.path.append('lib')
 
-from charms.layer import basic  # noqa
+from charms.layer import basic  # noqa E402
 basic.bootstrap_charm_deps()
-from charmhelpers.core.hookenv import action_set, action_fail, log
+from charmhelpers.core.hookenv import action_set, action_fail, log  # noqa E402
 
 
 def clear_sel(args):
diff --git a/src/tests/__init__.py b/src/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/tests/__init__.py
diff --git a/src/tests/charms/__init__.py b/src/tests/charms/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/tests/charms/__init__.py
diff --git a/src/tests/charms/layer/__init__.py b/src/tests/charms/layer/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/tests/charms/layer/__init__.py
diff --git a/src/tests/charms/layer/basic.py b/src/tests/charms/layer/basic.py
new file mode 100644
index 0000000..5434905
--- /dev/null
+++ b/src/tests/charms/layer/basic.py
@@ -0,0 +1,2 @@
+def bootstrap_charm_deps():
+    pass
diff --git a/src/tests/unit/test_actions.py b/src/tests/unit/test_actions.py
index aadca73..40c7fa4 100644
--- a/src/tests/unit/test_actions.py
+++ b/src/tests/unit/test_actions.py
@@ -12,10 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
+import sys
 import unittest
 import unittest.mock as mock
 
-from actions.actions import clear_sel
+sys.path.insert(0, '{}/{}'.format(os.getcwd(), 'tests'))
 
 
 class ClearSelTestCase(unittest.TestCase):
@@ -24,8 +26,9 @@ class ClearSelTestCase(unittest.TestCase):
     @mock.patch('subprocess.check_call')
     @mock.patch('charmhelpers.core.hookenv.log')
     def test_clear_sel(self, mock_log, mock_check_call, mock_subprocess):
+        from actions.actions import clear_sel  # noqa: E402
         sel_output = "Unittest system event log output"
         mock_subprocess.return_value = sel_output
         mock_check_call.return_value = None
-        clear_sel()
+        clear_sel('unittest')
         mock_check_call.assert_called_once_with(['action-set', "cleared_log={}".format(sel_output)])

Follow ups