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
=== modified file 'Makefile'
--- Makefile 2016-02-23 18:30:24 +0000
+++ Makefile 2017-01-25 17:40:28 +0000
@@ -40,7 +40,6 @@
40 sudo apt-get install -y gcc python-dev python-virtualenv python-apt40 sudo apt-get install -y gcc python-dev python-virtualenv python-apt
41 virtualenv .venv --system-site-packages41 virtualenv .venv --system-site-packages
42 .venv/bin/pip install -U pip42 .venv/bin/pip install -U pip
43 .venv/bin/pip install -U distribute
44 .venv/bin/pip install -I -r test_requirements.txt43 .venv/bin/pip install -I -r test_requirements.txt
45 .venv/bin/pip install bzr44 .venv/bin/pip install bzr
4645
@@ -48,7 +47,6 @@
48 sudo apt-get install -y gcc python3-dev python-virtualenv python3-apt47 sudo apt-get install -y gcc python3-dev python-virtualenv python3-apt
49 virtualenv .venv3 --python=python3 --system-site-packages48 virtualenv .venv3 --python=python3 --system-site-packages
50 .venv3/bin/pip install -U pip49 .venv3/bin/pip install -U pip
51 .venv3/bin/pip install -U distribute
52 .venv3/bin/pip install -I -r test_requirements.txt50 .venv3/bin/pip install -I -r test_requirements.txt
5351
54# Note we don't even attempt to run tests if lint isn't passing.52# Note we don't even attempt to run tests if lint isn't passing.
5553
=== modified file 'charmhelpers/contrib/network/ip.py'
--- charmhelpers/contrib/network/ip.py 2016-11-07 23:09:58 +0000
+++ charmhelpers/contrib/network/ip.py 2017-01-25 17:40:28 +0000
@@ -426,7 +426,7 @@
426426
427 try:427 try:
428 answers = dns.resolver.query(address, rtype)428 answers = dns.resolver.query(address, rtype)
429 except dns.resolver.NXDOMAIN as e:429 except dns.resolver.NXDOMAIN:
430 return None430 return None
431431
432 if answers:432 if answers:
433433
=== modified file 'test_requirements.txt'
--- test_requirements.txt 2016-01-29 09:23:31 +0000
+++ test_requirements.txt 2017-01-25 17:40:28 +0000
@@ -1,7 +1,7 @@
1# Test-only dependencies are unpinned.1# Test-only dependencies are unpinned.
2#2#
3pip3pip
4distribute4six
5coverage>=3.65coverage>=3.6
6mock>=1.0.1,<1.1.06mock>=1.0.1,<1.1.0
7nose>=1.3.17nose>=1.3.1
@@ -16,5 +16,4 @@
16Tempita==0.5.1 # precise16Tempita==0.5.1 # precise
17netifaces==0.10 # trusty is 0.8, but using py3 compatible version for tests.17netifaces==0.10 # trusty is 0.8, but using py3 compatible version for tests.
18Jinja2==2.6 # precise18Jinja2==2.6 # precise
19six==1.1 # precise
20psutil==1.2.1 # trusty19psutil==1.2.1 # trusty

Subscribers

People subscribed via source and target branches