← Back to team overview

cloud-init-dev team mailing list archive

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

 

Chad Smith has proposed merging ~chad.smith/cloud-init:add-cloudinit-pkg-to-all-targets into cloud-init:master.

Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/331099

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.

-- 
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:add-cloudinit-pkg-to-all-targets into cloud-init:master.
diff --git a/Makefile b/Makefile
index 9e7f4ee..9d2e2af 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ unittest: clean_pyc
 	nosetests $(noseopts) tests/unittests cloudinit
 
 unittest3: clean_pyc
-	nosetests3 $(noseopts) tests/unittests
+	nosetests3 $(noseopts) tests/unittests cloudinit
 
 ci-deps-ubuntu:
 	@$(PYVER) $(CWD)/tools/read-dependencies --distro ubuntu --test-distro
diff --git a/cloudinit/net/tests/test_dhcp.py b/cloudinit/net/tests/test_dhcp.py
index 1324c3d..a38edae 100644
--- a/cloudinit/net/tests/test_dhcp.py
+++ b/cloudinit/net/tests/test_dhcp.py
@@ -107,7 +107,8 @@ class TestDHCPDiscoveryClean(CiTestCase):
              'os.getuid': 0},
             maybe_perform_dhcp_discovery)
         self.assertEqual({'address': '192.168.2.2'}, retval)
-        m_dhcp.assert_called_once()
+        self.assertEqual(
+            1, m_dhcp.call_count, 'dhcp_discovery not called once')
         call = m_dhcp.call_args_list[0]
         self.assertEqual('/sbin/dhclient', call[0][0])
         self.assertEqual('eth9', call[0][1])
diff --git a/tox.ini b/tox.ini
index 72de983..776f425 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,7 +3,7 @@ envlist = py27, py3, flake8, xenial, pylint
 recreate = True
 
 [testenv]
-commands = python -m nose {posargs:tests/unittests}
+commands = python -m nose {posargs:tests/unittests cloudinit}
 setenv =
     LC_ALL = en_US.utf-8