Python 3: fix test_dhcp
In Python 3, dhcp.LOG.process is not called when calling dhcp.LOG.debug. Since what we really want to know is whether dhcp.LOG.debug is called, tweak the test a little. Change-Id: I9c9d9a6162181d6e518a603193013c28e218cdee Blueprint: neutron-python3
This commit is contained in:
parent
dec8743b53
commit
1f76a9061d
@ -1652,13 +1652,13 @@ class TestDnsmasq(TestBase):
|
|||||||
|
|
||||||
def test__output_hosts_file_log_only_twice(self):
|
def test__output_hosts_file_log_only_twice(self):
|
||||||
dm = self._get_dnsmasq(FakeDualStackNetworkSingleDHCP())
|
dm = self._get_dnsmasq(FakeDualStackNetworkSingleDHCP())
|
||||||
with mock.patch.object(dhcp.LOG, 'process') as process:
|
with mock.patch.object(dhcp, 'LOG') as logger:
|
||||||
process.return_value = ('fake_message', {})
|
logger.process.return_value = ('fake_message', {})
|
||||||
dm._output_hosts_file()
|
dm._output_hosts_file()
|
||||||
# The method logs twice, at the start of and the end. There should be
|
# The method logs twice, at the start of and the end. There should be
|
||||||
# no other logs, no matter how many hosts there are to dump in the
|
# no other logs, no matter how many hosts there are to dump in the
|
||||||
# file.
|
# file.
|
||||||
self.assertEqual(2, process.call_count)
|
self.assertEqual(2, len(logger.method_calls))
|
||||||
|
|
||||||
def test_only_populates_dhcp_enabled_subnets(self):
|
def test_only_populates_dhcp_enabled_subnets(self):
|
||||||
exp_host_name = '/dhcp/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/host'
|
exp_host_name = '/dhcp/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/host'
|
||||||
|
1
tox.ini
1
tox.ini
@ -201,6 +201,7 @@ commands = python -m testtools.run \
|
|||||||
neutron.tests.unit.agent.linux.test_ip_monitor \
|
neutron.tests.unit.agent.linux.test_ip_monitor \
|
||||||
neutron.tests.unit.agent.linux.test_iptables_manager \
|
neutron.tests.unit.agent.linux.test_iptables_manager \
|
||||||
neutron.tests.unit.agent.linux.test_external_process \
|
neutron.tests.unit.agent.linux.test_external_process \
|
||||||
|
neutron.tests.unit.agent.linux.test_dhcp \
|
||||||
neutron.tests.unit.agent.linux.test_async_process \
|
neutron.tests.unit.agent.linux.test_async_process \
|
||||||
neutron.tests.unit.agent.linux.test_ovsdb_monitor \
|
neutron.tests.unit.agent.linux.test_ovsdb_monitor \
|
||||||
neutron.tests.unit.agent.linux.test_bridge_lib \
|
neutron.tests.unit.agent.linux.test_bridge_lib \
|
||||||
|
Loading…
Reference in New Issue
Block a user