]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Add OpenFixture and get rid of 'open' mocks
authorKevin Benton <blak111@gmail.com>
Thu, 8 Oct 2015 19:31:32 +0000 (12:31 -0700)
committerKevin Benton <kevinbenton@buttewifi.com>
Fri, 9 Oct 2015 19:20:53 +0000 (19:20 +0000)
commit3330c5554518be056b8f2506567bf5f4c1f12db7
tree58947f0c7be69372f303913262a8265687023c2a
parentdcbc56426315d4e56e3b254656dc7b89cc71e3d9
Add OpenFixture and get rid of 'open' mocks

This patch adds a new fixture that allows a specific
file to be mocked for 'open' calls while leaving the
normal 'open' behavior for everything else. This is to
prevent cases like the related bug where a library we
depend on can unexpectedly call 'open' on its own
(in that case it was debtcollector->warnings->linecache).

It also replaces all open mocks in the unit tests with
this new fixture.

Related-Bug: #1503847
Change-Id: Ie9e1a01acd5cb231718efd028d30df6c8dbcd3f0
neutron/tests/tools.py
neutron/tests/unit/agent/linux/test_daemon.py
neutron/tests/unit/agent/linux/test_dhcp.py
neutron/tests/unit/agent/linux/test_external_process.py
neutron/tests/unit/common/test_ipv6_utils.py
neutron/tests/unit/db/test_migration.py