Merge lp:~tribaal/charm-helpers/make-test-great-again into lp:charm-helpers

Proposed by Chris Glass
Status: Merged
Merged at revision: 678
Proposed branch: lp:~tribaal/charm-helpers/make-test-great-again
Merge into: lp:charm-helpers
Diff against target: 51 lines (+2/-5)
3 files modified
Makefile (+0/-2)
charmhelpers/contrib/network/ip.py (+1/-1)
test_requirements.txt (+1/-2)
To merge this branch: bzr merge lp:~tribaal/charm-helpers/make-test-great-again
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+315604@code.launchpad.net

Description of the change

This branch fixes the project so that invoking "make test" runs the tests successfully on trusty, xenial, yakkety and zesty.

For the record despite comments in the changed files mentioning precise, tests don't run on precise regardless of this branch being merged in or not.

Note: one test fails if juju is not installed, but properly isolating the test (using a mock, for instance) is outside the scope of this MP.

Steps taken to test:
(repeated on trusty, xenial, yakkety and zesty on LXD)

lxc launch ubuntu:<series>
lxc exec <name> /bin/bash
apt update && apt upgrade
apt install bzr make juju # juju is needed because a test is not isolated properly
bzr co lp:~tribaal/charm-helpers/make-test-great-again
cd make-test-great-again
make test

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Is good.

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

For future ideas:
 - I think this would benefit from tox.
 - A cleantest target (or just update test) that uses lxd
 - Some more pinning is needed, in particular there are fails if python-flake8, python-mcabe or python-mock are installed in xenial's system python. Or maybe now we don't have precise we can avoid including system packages in the venv.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2016-02-23 18:30:24 +0000
3+++ Makefile 2017-01-25 17:40:28 +0000
4@@ -40,7 +40,6 @@
5 sudo apt-get install -y gcc python-dev python-virtualenv python-apt
6 virtualenv .venv --system-site-packages
7 .venv/bin/pip install -U pip
8- .venv/bin/pip install -U distribute
9 .venv/bin/pip install -I -r test_requirements.txt
10 .venv/bin/pip install bzr
11
12@@ -48,7 +47,6 @@
13 sudo apt-get install -y gcc python3-dev python-virtualenv python3-apt
14 virtualenv .venv3 --python=python3 --system-site-packages
15 .venv3/bin/pip install -U pip
16- .venv3/bin/pip install -U distribute
17 .venv3/bin/pip install -I -r test_requirements.txt
18
19 # Note we don't even attempt to run tests if lint isn't passing.
20
21=== modified file 'charmhelpers/contrib/network/ip.py'
22--- charmhelpers/contrib/network/ip.py 2016-11-07 23:09:58 +0000
23+++ charmhelpers/contrib/network/ip.py 2017-01-25 17:40:28 +0000
24@@ -426,7 +426,7 @@
25
26 try:
27 answers = dns.resolver.query(address, rtype)
28- except dns.resolver.NXDOMAIN as e:
29+ except dns.resolver.NXDOMAIN:
30 return None
31
32 if answers:
33
34=== modified file 'test_requirements.txt'
35--- test_requirements.txt 2016-01-29 09:23:31 +0000
36+++ test_requirements.txt 2017-01-25 17:40:28 +0000
37@@ -1,7 +1,7 @@
38 # Test-only dependencies are unpinned.
39 #
40 pip
41-distribute
42+six
43 coverage>=3.6
44 mock>=1.0.1,<1.1.0
45 nose>=1.3.1
46@@ -16,5 +16,4 @@
47 Tempita==0.5.1 # precise
48 netifaces==0.10 # trusty is 0.8, but using py3 compatible version for tests.
49 Jinja2==2.6 # precise
50-six==1.1 # precise
51 psutil==1.2.1 # trusty

Subscribers

People subscribed via source and target branches