Merge ~chad.smith/cloud-init:add-cloudinit-pkg-to-all-targets into cloud-init:master

Proposed by Chad Smith on 2017-09-20
Status: Merged
Merged at revision: d3a8777244ebc107e1124c4fab441b5e0eb75f44
Proposed branch: ~chad.smith/cloud-init:add-cloudinit-pkg-to-all-targets
Merge into: cloud-init:master
Diff against target: 39 lines (+4/-3)
3 files modified
Makefile (+1/-1)
cloudinit/net/tests/test_dhcp.py (+2/-1)
tox.ini (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve on 2017-09-20
cloud-init commiters 2017-09-20 Pending
Review via email: mp+331099@code.launchpad.net

Description of the Change

tests: Add cloudinit package to all test targets

The package cloudinit was sparsely added to only the makefile's unittest
target and tox's py3 target. This branch adds cloudinit package to
'make unittest3' and all tox environments. It tweaks one cloudinit unit
test to use mocked_object.call_count instead of
mocked_object.assert_called_once which is not defined in some python
unittest versions.

To post a comment you must log in.

PASSED: Continuous integration, rev:dfb0628ecd69fca93e74de6db0abd3960d7948b3
https://jenkins.ubuntu.com/server/job/cloud-init-ci/335/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/335/rebuild

review: Approve (continuous-integration)
Scott Moser (smoser) wrote :

ack.

I approve this.
kind of confused on why assert_called_once() wasnt failing.

perhaps we were just always getting a python-mock package or installed from pip rather than the python built in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 9e7f4ee..9d2e2af 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -51,7 +51,7 @@ unittest: clean_pyc
6 nosetests $(noseopts) tests/unittests cloudinit
7
8 unittest3: clean_pyc
9- nosetests3 $(noseopts) tests/unittests
10+ nosetests3 $(noseopts) tests/unittests cloudinit
11
12 ci-deps-ubuntu:
13 @$(PYVER) $(CWD)/tools/read-dependencies --distro ubuntu --test-distro
14diff --git a/cloudinit/net/tests/test_dhcp.py b/cloudinit/net/tests/test_dhcp.py
15index 1324c3d..a38edae 100644
16--- a/cloudinit/net/tests/test_dhcp.py
17+++ b/cloudinit/net/tests/test_dhcp.py
18@@ -107,7 +107,8 @@ class TestDHCPDiscoveryClean(CiTestCase):
19 'os.getuid': 0},
20 maybe_perform_dhcp_discovery)
21 self.assertEqual({'address': '192.168.2.2'}, retval)
22- m_dhcp.assert_called_once()
23+ self.assertEqual(
24+ 1, m_dhcp.call_count, 'dhcp_discovery not called once')
25 call = m_dhcp.call_args_list[0]
26 self.assertEqual('/sbin/dhclient', call[0][0])
27 self.assertEqual('eth9', call[0][1])
28diff --git a/tox.ini b/tox.ini
29index 72de983..776f425 100644
30--- a/tox.ini
31+++ b/tox.ini
32@@ -3,7 +3,7 @@ envlist = py27, py3, flake8, xenial, pylint
33 recreate = True
34
35 [testenv]
36-commands = python -m nose {posargs:tests/unittests}
37+commands = python -m nose {posargs:tests/unittests cloudinit}
38 setenv =
39 LC_ALL = en_US.utf-8
40

Subscribers

People subscribed via source and target branches