]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
UT: do not hide an original error in test resource ctxtmgr
authorAkihiro Motoki <motoki@da.jp.nec.com>
Fri, 21 Mar 2014 23:17:20 +0000 (08:17 +0900)
committerGerrit Code Review <review@openstack.org>
Fri, 28 Mar 2014 05:49:13 +0000 (05:49 +0000)
commit9730c185847e1cc3fe0ced10f98a14a112e23a07
treead7a01ef9e96fd692eef8b20e918596611cc92c8
parent721830c541f32b71b8c55a80371dce74046b9e9a
UT: do not hide an original error in test resource ctxtmgr

In unit tests, resource contextmanagers such as network(), subnet()
try to delete themselves after returning from yield even if an
exception occurs. However when an exception occurs, there is a case
where deletion fails. In this case original exception will be hidden
and it makes difficult to debug test failures.

Before each test starts, resources like database entries will be
recreated, so there is no need to try to delete resources even
when an exception occurs. This commit removes try-finally clause
from resource contextmanagers to make original errors visible.

Closes-Bug: #1295887
Change-Id: Ia844d2aa2c9fc036e643068c5284f64798963ee3
14 files changed:
neutron/tests/unit/cisco/test_network_plugin.py
neutron/tests/unit/db/firewall/test_db_firewall.py
neutron/tests/unit/db/loadbalancer/test_db_loadbalancer.py
neutron/tests/unit/db/metering/test_db_metering.py
neutron/tests/unit/db/vpn/test_db_vpnaas.py
neutron/tests/unit/nec/test_packet_filter.py
neutron/tests/unit/nuage/test_netpartition.py
neutron/tests/unit/test_db_plugin.py
neutron/tests/unit/test_extension_security_group.py
neutron/tests/unit/test_l3_plugin.py
neutron/tests/unit/test_l3_schedulers.py
neutron/tests/unit/vmware/extensions/test_qosqueues.py
neutron/tests/unit/vmware/test_nsx_sync.py
neutron/tests/unit/vmware/vshield/test_vpnaas_plugin.py