← 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:
  Peter Sabaini (peter-sabaini)

For more details, see:
https://code.launchpad.net/~xavpaice/hw-health-charm/+git/hw-health-charm/+merge/363813
-- 
Your team Nagios Charm developers is subscribed to branch hw-health-charm:master.
diff --git a/Makefile b/Makefile
index d1043f4..20a6f9b 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,8 @@ help:
 
 lint:
 	@echo "Running flake8"
-	@flake8 --max-line-length=80 ./src
+	cd src && tox -e pep8
+
 
 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..9e27f0c 100755
--- a/src/actions/actions.py
+++ b/src/actions/actions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/local/sbin/charm-env python3
 #
 # Copyright 2016,2019 Canonical Ltd
 #
@@ -17,10 +17,7 @@
 import os
 import subprocess
 import sys
-sys.path.append('lib')
 
-from charms.layer import basic  # noqa
-basic.bootstrap_charm_deps()
 from charmhelpers.core.hookenv import action_set, action_fail, log
 
 
@@ -49,7 +46,7 @@ def main(args):
     try:
         ACTIONS[action_name]
     except Exception as e:
-            action_fail(str(e))
+        action_fail(str(e))
 
 
 if __name__ == "__main__":
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/unit/test_actions.py b/src/tests/unit/test_actions.py
index aadca73..3df07a3 100644
--- a/src/tests/unit/test_actions.py
+++ b/src/tests/unit/test_actions.py
@@ -27,5 +27,5 @@ class ClearSelTestCase(unittest.TestCase):
         sel_output = "Unittest system event log output"
         mock_subprocess.return_value = sel_output
         mock_check_call.return_value = None
-        clear_sel()
+        clear_sel('dummy_arg')
         mock_check_call.assert_called_once_with(['action-set', "cleared_log={}".format(sel_output)])
diff --git a/src/tox.ini b/src/tox.ini
index 491fbe6..522cffd 100644
--- a/src/tox.ini
+++ b/src/tox.ini
@@ -17,5 +17,5 @@ commands =
 basepython = python3
 deps =
   flake8
-commands = flake8 {posargs} --max-complexity=20 --max-line-length=120 reactive files unit_tests
+commands = flake8 {posargs} --max-complexity=20 --max-line-length=120 .
 

Follow ups