Merge lp:~tvansteenburgh/charms/precise/apache2/fix-tests into lp:charms/apache2

Proposed by Tim Van Steenburgh
Status: Merged
Merged at revision: 59
Proposed branch: lp:~tvansteenburgh/charms/precise/apache2/fix-tests
Merge into: lp:charms/apache2
Diff against target: 70 lines (+15/-7)
3 files modified
Makefile (+10/-2)
hooks/hooks.py (+4/-4)
hooks/tests/test_nrpe_hooks.py (+1/-1)
To merge this branch: bzr merge lp:~tvansteenburgh/charms/precise/apache2/fix-tests
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review via email: mp+234161@code.launchpad.net

Description of the change

Fix test/lint errors.

To post a comment you must log in.
Revision history for this message
Matt Bruzek (mbruzek) wrote :

Hey Tim,

These changes to the Makefile look great! The bundletests pass now. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2013-10-10 22:47:57 +0000
3+++ Makefile 2014-09-10 17:35:54 +0000
4@@ -17,9 +17,9 @@
5 @(charm proof $(PWD) || [ $$? -eq 100 ]) && echo OK
6 @test `cat revision` = 0 && rm revision
7
8-test:
9+test: .venv
10 @echo Starting tests...
11- @CHARM_DIR=$(CHARM_DIR) $(TEST_PREFIX) nosetests $(TEST_DIR)
12+ @CHARM_DIR=$(CHARM_DIR) $(TEST_PREFIX) .venv/bin/nosetests $(TEST_DIR)
13
14 lint:
15 @echo Checking for Python syntax...
16@@ -36,4 +36,12 @@
17 -d hooks/charmhelpers
18 @echo Do not forget to commit the updated files if any.
19
20+.venv:
21+ sudo apt-get install python-virtualenv python-apt
22+ virtualenv .venv --system-site-packages
23+ .venv/bin/pip install -I nose testtools mock pyyaml
24+
25+clean:
26+ rm -rf .venv
27+
28 .PHONY: revision proof test lint sourcedeps charm-payload
29
30=== modified file 'hooks/hooks.py'
31--- hooks/hooks.py 2014-06-28 19:26:04 +0000
32+++ hooks/hooks.py 2014-09-10 17:35:54 +0000
33@@ -68,9 +68,9 @@
34 dpkg.communicate(input=selections)
35
36
37-#------------------------------------------------------------------------------
38+# -----------------------------------------------------------------------------
39 # apt_get_purge( package ): Purges a package
40-#------------------------------------------------------------------------------
41+# -----------------------------------------------------------------------------
42 def apt_get_purge(packages=None):
43 if packages is None:
44 return False
45@@ -79,10 +79,10 @@
46 return subprocess.call(cmd_line)
47
48
49-#------------------------------------------------------------------------------
50+# -----------------------------------------------------------------------------
51 # service_apache2: Convenience function to start/stop/restart/reload
52 # the apache2 service
53-#------------------------------------------------------------------------------
54+# -----------------------------------------------------------------------------
55 def service_apache2(action=None):
56 if action is None:
57 return
58
59=== modified file 'hooks/tests/test_nrpe_hooks.py'
60--- hooks/tests/test_nrpe_hooks.py 2013-10-10 22:47:57 +0000
61+++ hooks/tests/test_nrpe_hooks.py 2014-09-10 17:35:54 +0000
62@@ -44,7 +44,7 @@
63 patcher = patch.object(data['object'], attr, create=create)
64 self.patched[attr] = patcher.start()
65 self.addCleanup(patcher.stop)
66- if not 'JUJU_UNIT_NAME' in os.environ:
67+ if 'JUJU_UNIT_NAME' not in os.environ:
68 os.environ['JUJU_UNIT_NAME'] = 'test'
69
70 def check_call_counts(self, **kwargs):

Subscribers

People subscribed via source and target branches