]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Reorganize unit test tree
authorMaru Newby <marun@redhat.com>
Sat, 4 Apr 2015 00:22:05 +0000 (00:22 +0000)
committerMaru Newby <marun@redhat.com>
Mon, 6 Apr 2015 23:28:31 +0000 (23:28 +0000)
This change ensures that the structure of the unit test tree matches
that of the code tree to make it obvious where to find tests for a
given module.  A check is added to the pep8 job to protect against
regressions.

The plugin test paths are relocated to neutron/tests/unit/plugins
but are otherwise ignored for now.

Change-Id: If307593259139171be21a71c58e3a34bf148cc7f
Partial-Bug: #1440834

165 files changed:
TESTING.rst
neutron/tests/etc/api-paste.ini.test
neutron/tests/retargetable/base.py
neutron/tests/unit/_test_extension_portbindings.py
neutron/tests/unit/agent/common/test_config.py [moved from neutron/tests/unit/test_agent_config.py with 100% similarity]
neutron/tests/unit/agent/dhcp/__init__.py [moved from neutron/tests/unit/brocade/__init__.py with 100% similarity]
neutron/tests/unit/agent/dhcp/test_agent.py [moved from neutron/tests/unit/test_dhcp_agent.py with 100% similarity]
neutron/tests/unit/agent/l3/test_agent.py [moved from neutron/tests/unit/test_l3_agent.py with 100% similarity]
neutron/tests/unit/agent/l3/test_dvr_fip_ns.py [moved from neutron/tests/unit/agent/test_dvr_fip_ns.py with 100% similarity]
neutron/tests/unit/agent/l3/test_link_local_allocator.py [moved from neutron/tests/unit/test_l3_dvr.py with 100% similarity]
neutron/tests/unit/agent/l3/test_router_processing_queue.py [moved from neutron/tests/unit/test_router_processing_queue.py with 100% similarity]
neutron/tests/unit/agent/linux/test_daemon.py [moved from neutron/tests/unit/test_linux_daemon.py with 100% similarity]
neutron/tests/unit/agent/linux/test_dhcp.py [moved from neutron/tests/unit/test_linux_dhcp.py with 100% similarity]
neutron/tests/unit/agent/linux/test_external_process.py [moved from neutron/tests/unit/test_linux_external_process.py with 100% similarity]
neutron/tests/unit/agent/linux/test_interface.py [moved from neutron/tests/unit/test_linux_interface.py with 100% similarity]
neutron/tests/unit/agent/linux/test_ip_lib.py [moved from neutron/tests/unit/test_linux_ip_lib.py with 100% similarity]
neutron/tests/unit/agent/linux/test_iptables_firewall.py [moved from neutron/tests/unit/test_iptables_firewall.py with 99% similarity]
neutron/tests/unit/agent/linux/test_iptables_manager.py [moved from neutron/tests/unit/test_iptables_manager.py with 100% similarity]
neutron/tests/unit/agent/metadata/test_agent.py [moved from neutron/tests/unit/test_metadata_agent.py with 100% similarity]
neutron/tests/unit/agent/metadata/test_namespace_proxy.py [moved from neutron/tests/unit/test_metadata_namespace_proxy.py with 100% similarity]
neutron/tests/unit/agent/test_rpc.py [moved from neutron/tests/unit/test_agent_rpc.py with 100% similarity]
neutron/tests/unit/agent/test_securitygroups_rpc.py [moved from neutron/tests/unit/test_security_groups_rpc.py with 99% similarity]
neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py [moved from neutron/tests/unit/test_dhcp_rpc.py with 100% similarity]
neutron/tests/unit/api/test_api_common.py [moved from neutron/tests/unit/test_api_api_common.py with 100% similarity]
neutron/tests/unit/api/test_extensions.py [moved from neutron/tests/unit/test_extensions.py with 99% similarity]
neutron/tests/unit/api/v2/__init__.py [moved from neutron/tests/unit/cisco/__init__.py with 100% similarity]
neutron/tests/unit/api/v2/test_attributes.py [moved from neutron/tests/unit/test_attributes.py with 100% similarity]
neutron/tests/unit/api/v2/test_base.py [moved from neutron/tests/unit/test_api_v2.py with 99% similarity]
neutron/tests/unit/api/v2/test_resource.py [moved from neutron/tests/unit/test_api_v2_resource.py with 100% similarity]
neutron/tests/unit/cmd/__init__.py [moved from neutron/tests/unit/cisco/n1kv/__init__.py with 100% similarity]
neutron/tests/unit/cmd/test_netns_cleanup.py [moved from neutron/tests/unit/test_netns_cleanup.py with 100% similarity]
neutron/tests/unit/cmd/test_ovs_cleanup.py [moved from neutron/tests/unit/test_ovs_cleanup.py with 100% similarity]
neutron/tests/unit/common/__init__.py [moved from neutron/tests/unit/embrane/__init__.py with 100% similarity]
neutron/tests/unit/common/test_config.py [moved from neutron/tests/unit/test_config.py with 100% similarity]
neutron/tests/unit/common/test_ipv6_utils.py [moved from neutron/tests/unit/test_ipv6.py with 100% similarity]
neutron/tests/unit/common/test_log.py [moved from neutron/tests/unit/test_common_log.py with 100% similarity]
neutron/tests/unit/common/test_rpc.py [moved from neutron/tests/unit/test_rpc_service.py with 100% similarity]
neutron/tests/unit/common/test_utils.py [moved from neutron/tests/unit/test_common_utils.py with 100% similarity]
neutron/tests/unit/db/metering/test_metering_db.py [moved from neutron/tests/unit/db/metering/test_db_metering.py with 98% similarity]
neutron/tests/unit/db/test_agents_db.py [moved from neutron/tests/unit/db/test_agent_db.py with 100% similarity]
neutron/tests/unit/db/test_allowedaddresspairs_db.py [moved from neutron/tests/unit/test_extension_allowedaddresspairs.py with 98% similarity]
neutron/tests/unit/db/test_db_base_plugin_v2.py [moved from neutron/tests/unit/test_db_plugin.py with 99% similarity]
neutron/tests/unit/db/test_l3_hamode_db.py [moved from neutron/tests/unit/db/test_l3_ha_db.py with 100% similarity]
neutron/tests/unit/db/test_migration.py [moved from neutron/tests/unit/test_db_migration.py with 100% similarity]
neutron/tests/unit/debug/__init__.py [moved from neutron/tests/unit/hyperv/__init__.py with 100% similarity]
neutron/tests/unit/debug/test_commands.py [moved from neutron/tests/unit/test_debug_commands.py with 100% similarity]
neutron/tests/unit/extensions/base.py [moved from neutron/tests/unit/test_api_v2_extension.py with 96% similarity]
neutron/tests/unit/extensions/test_agent.py [moved from neutron/tests/unit/test_agent_ext_plugin.py with 97% similarity]
neutron/tests/unit/extensions/test_external_net.py [moved from neutron/tests/unit/test_extension_ext_net.py with 96% similarity]
neutron/tests/unit/extensions/test_extra_dhcp_opt.py [moved from neutron/tests/unit/test_extension_extradhcpopts.py with 98% similarity]
neutron/tests/unit/extensions/test_extraroute.py [moved from neutron/tests/unit/test_extension_extraroute.py with 98% similarity]
neutron/tests/unit/extensions/test_l3.py [moved from neutron/tests/unit/test_l3_plugin.py with 99% similarity]
neutron/tests/unit/extensions/test_l3_ext_gw_mode.py [moved from neutron/tests/unit/test_extension_ext_gw_mode.py with 96% similarity]
neutron/tests/unit/extensions/test_netmtu.py [moved from neutron/tests/unit/test_extension_netmtu.py with 93% similarity]
neutron/tests/unit/extensions/test_portsecurity.py [moved from neutron/tests/unit/test_extension_portsecurity.py with 98% similarity]
neutron/tests/unit/extensions/test_providernet.py [moved from neutron/tests/unit/test_extension_pnet.py with 94% similarity]
neutron/tests/unit/extensions/test_quotasv2.py [moved from neutron/tests/unit/test_quota_ext.py with 99% similarity]
neutron/tests/unit/extensions/test_securitygroup.py [moved from neutron/tests/unit/test_extension_security_group.py with 99% similarity]
neutron/tests/unit/extensions/test_servicetype.py [moved from neutron/tests/unit/test_servicetype.py with 96% similarity]
neutron/tests/unit/ipam/test_subnet_alloc.py
neutron/tests/unit/notifiers/test_nova.py [moved from neutron/tests/unit/notifiers/test_notifiers_nova.py with 100% similarity]
neutron/tests/unit/plugins/__init__.py [moved from neutron/tests/unit/ibm/__init__.py with 100% similarity]
neutron/tests/unit/plugins/brocade/__init__.py [moved from neutron/tests/unit/ipam/__init__.py with 100% similarity]
neutron/tests/unit/plugins/brocade/test_brocade_db.py [moved from neutron/tests/unit/brocade/test_brocade_db.py with 98% similarity]
neutron/tests/unit/plugins/brocade/test_brocade_plugin.py [moved from neutron/tests/unit/brocade/test_brocade_plugin.py with 97% similarity]
neutron/tests/unit/plugins/brocade/test_brocade_vlan.py [moved from neutron/tests/unit/brocade/test_brocade_vlan.py with 100% similarity]
neutron/tests/unit/plugins/cisco/__init__.py [moved from neutron/tests/unit/linuxbridge/__init__.py with 100% similarity]
neutron/tests/unit/plugins/cisco/n1kv/__init__.py [moved from neutron/tests/unit/ml2/__init__.py with 100% similarity]
neutron/tests/unit/plugins/cisco/n1kv/fake_client.py [moved from neutron/tests/unit/cisco/n1kv/fake_client.py with 100% similarity]
neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_db.py [moved from neutron/tests/unit/cisco/n1kv/test_n1kv_db.py with 99% similarity]
neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_plugin.py [moved from neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py with 99% similarity]
neutron/tests/unit/plugins/cisco/test_network_db.py [moved from neutron/tests/unit/cisco/test_network_db.py with 100% similarity]
neutron/tests/unit/plugins/embrane/__init__.py [moved from neutron/tests/unit/ml2/db/__init__.py with 100% similarity]
neutron/tests/unit/plugins/embrane/test_embrane_l3_plugin.py [moved from neutron/tests/unit/embrane/test_embrane_l3_plugin.py with 93% similarity]
neutron/tests/unit/plugins/embrane/test_embrane_neutron_plugin.py [moved from neutron/tests/unit/embrane/test_embrane_neutron_plugin.py with 97% similarity]
neutron/tests/unit/plugins/hyperv/__init__.py [moved from neutron/tests/unit/ml2/drivers/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ibm/__init__.py [moved from neutron/tests/unit/ml2/drivers/arista/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ibm/test_sdnve_agent.py [moved from neutron/tests/unit/ibm/test_sdnve_agent.py with 100% similarity]
neutron/tests/unit/plugins/ibm/test_sdnve_api.py [moved from neutron/tests/unit/ibm/test_sdnve_api.py with 100% similarity]
neutron/tests/unit/plugins/ibm/test_sdnve_plugin.py [moved from neutron/tests/unit/ibm/test_sdnve_plugin.py with 94% similarity]
neutron/tests/unit/plugins/linuxbridge/__init__.py [moved from neutron/tests/unit/ml2/drivers/cisco/__init__.py with 100% similarity]
neutron/tests/unit/plugins/linuxbridge/test_lb_neutron_agent.py [moved from neutron/tests/unit/linuxbridge/test_lb_neutron_agent.py with 100% similarity]
neutron/tests/unit/plugins/ml2/__init__.py [moved from neutron/tests/unit/ml2/drivers/cisco/apic/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/_test_mech_agent.py [moved from neutron/tests/unit/ml2/_test_mech_agent.py with 100% similarity]
neutron/tests/unit/plugins/ml2/db/__init__.py [moved from neutron/tests/unit/ml2/drivers/cisco/ncs/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/db/test_ml2_db.py [moved from neutron/tests/unit/ml2/db/test_ml2_db.py with 100% similarity]
neutron/tests/unit/plugins/ml2/db/test_ml2_dvr_db.py [moved from neutron/tests/unit/ml2/db/test_ml2_dvr_db.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/__init__.py [moved from neutron/tests/unit/ml2/drivers/freescale/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/arista/__init__.py [moved from neutron/tests/unit/ml2/drivers/mech_sriov/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/arista/test_arista_mechanism_driver.py [moved from neutron/tests/unit/ml2/drivers/arista/test_arista_mechanism_driver.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/__init__.py [moved from neutron/tests/unit/ml2/extensions/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/apic/__init__.py [moved from neutron/tests/unit/oneconvergence/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_common.py [moved from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_common.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py [moved from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py with 99% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_sync.py [moved from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_sync.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py [moved from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py with 99% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/__init__.py [moved from neutron/tests/unit/opencontrail/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py [moved from neutron/tests/unit/ml2/drivers/cisco/ncs/test_mechanism_ncs.py with 95% similarity]
neutron/tests/unit/plugins/ml2/drivers/ext_test.py [moved from neutron/tests/unit/ml2/drivers/ext_test.py with 99% similarity]
neutron/tests/unit/plugins/ml2/drivers/freescale/__init__.py [moved from neutron/tests/unit/openvswitch/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py [moved from neutron/tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py with 99% similarity]
neutron/tests/unit/plugins/ml2/drivers/mech_fake_agent.py [moved from neutron/tests/unit/ml2/drivers/mech_fake_agent.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/__init__.py [moved from neutron/tests/unit/sriovnicagent/__init__.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py [moved from neutron/tests/unit/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py with 99% similarity]
neutron/tests/unit/plugins/ml2/drivers/mechanism_logger.py [moved from neutron/tests/unit/ml2/drivers/mechanism_logger.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py [moved from neutron/tests/unit/ml2/drivers/mechanism_test.py with 100% similarity]
neutron/tests/unit/plugins/ml2/drivers/test_l2population.py [moved from neutron/tests/unit/ml2/drivers/test_l2population.py with 99% similarity]
neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py [moved from neutron/tests/unit/ml2/drivers/test_mech_mlnx.py with 98% similarity]
neutron/tests/unit/plugins/ml2/extensions/__init__.py [new file with mode: 0644]
neutron/tests/unit/plugins/ml2/extensions/test_extension.py [moved from neutron/tests/unit/ml2/extensions/test_extension.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_agent_scheduler.py [moved from neutron/tests/unit/ml2/test_agent_scheduler.py with 90% similarity]
neutron/tests/unit/plugins/ml2/test_driver_context.py [moved from neutron/tests/unit/ml2/test_driver_context.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py [moved from neutron/tests/unit/ml2/test_ext_portsecurity.py with 89% similarity]
neutron/tests/unit/plugins/ml2/test_extension_driver_api.py [moved from neutron/tests/unit/ml2/test_extension_driver_api.py with 98% similarity]
neutron/tests/unit/plugins/ml2/test_helpers.py [moved from neutron/tests/unit/ml2/test_helpers.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py [moved from neutron/tests/unit/ml2/test_mech_linuxbridge.py with 97% similarity]
neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py [moved from neutron/tests/unit/ml2/test_mech_openvswitch.py with 98% similarity]
neutron/tests/unit/plugins/ml2/test_mechanism_odl.py [moved from neutron/tests/unit/ml2/test_mechanism_odl.py with 98% similarity]
neutron/tests/unit/plugins/ml2/test_ml2_plugin.py [moved from neutron/tests/unit/ml2/test_ml2_plugin.py with 99% similarity]
neutron/tests/unit/plugins/ml2/test_port_binding.py [moved from neutron/tests/unit/ml2/test_port_binding.py with 99% similarity]
neutron/tests/unit/plugins/ml2/test_rpcapi.py [moved from neutron/tests/unit/ml2/test_rpcapi.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_security_group.py [moved from neutron/tests/unit/ml2/test_security_group.py with 95% similarity]
neutron/tests/unit/plugins/ml2/test_type_flat.py [moved from neutron/tests/unit/ml2/test_type_flat.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_type_gre.py [moved from neutron/tests/unit/ml2/test_type_gre.py with 98% similarity]
neutron/tests/unit/plugins/ml2/test_type_local.py [moved from neutron/tests/unit/ml2/test_type_local.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_type_tunnel.py [moved from neutron/tests/unit/ml2/test_type_tunnel.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_type_vlan.py [moved from neutron/tests/unit/ml2/test_type_vlan.py with 100% similarity]
neutron/tests/unit/plugins/ml2/test_type_vxlan.py [moved from neutron/tests/unit/ml2/test_type_vxlan.py with 97% similarity]
neutron/tests/unit/plugins/oneconvergence/__init__.py [new file with mode: 0644]
neutron/tests/unit/plugins/oneconvergence/test_nvsd_agent.py [moved from neutron/tests/unit/oneconvergence/test_nvsd_agent.py with 100% similarity]
neutron/tests/unit/plugins/oneconvergence/test_nvsd_plugin.py [moved from neutron/tests/unit/oneconvergence/test_nvsd_plugin.py with 94% similarity]
neutron/tests/unit/plugins/oneconvergence/test_nvsdlib.py [moved from neutron/tests/unit/oneconvergence/test_nvsdlib.py with 100% similarity]
neutron/tests/unit/plugins/oneconvergence/test_plugin_helper.py [moved from neutron/tests/unit/oneconvergence/test_plugin_helper.py with 100% similarity]
neutron/tests/unit/plugins/oneconvergence/test_security_group.py [moved from neutron/tests/unit/oneconvergence/test_security_group.py with 94% similarity]
neutron/tests/unit/plugins/opencontrail/__init__.py [new file with mode: 0644]
neutron/tests/unit/plugins/opencontrail/test_contrail_plugin.py [moved from neutron/tests/unit/opencontrail/test_contrail_plugin.py with 97% similarity]
neutron/tests/unit/plugins/openvswitch/__init__.py [new file with mode: 0644]
neutron/tests/unit/plugins/openvswitch/test_agent_scheduler.py [moved from neutron/tests/unit/openvswitch/test_agent_scheduler.py with 98% similarity]
neutron/tests/unit/plugins/openvswitch/test_ovs_dvr_neutron_agent.py [moved from neutron/tests/unit/openvswitch/test_ovs_dvr_neutron_agent.py with 100% similarity]
neutron/tests/unit/plugins/openvswitch/test_ovs_neutron_agent.py [moved from neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py with 100% similarity]
neutron/tests/unit/plugins/openvswitch/test_ovs_tunnel.py [moved from neutron/tests/unit/openvswitch/test_ovs_tunnel.py with 100% similarity]
neutron/tests/unit/plugins/sriovnicagent/__init__.py [new file with mode: 0644]
neutron/tests/unit/plugins/sriovnicagent/test_eswitch_manager.py [moved from neutron/tests/unit/sriovnicagent/test_eswitch_manager.py with 100% similarity]
neutron/tests/unit/plugins/sriovnicagent/test_pci_lib.py [moved from neutron/tests/unit/sriovnicagent/test_pci_lib.py with 100% similarity]
neutron/tests/unit/plugins/sriovnicagent/test_sriov_agent_config.py [moved from neutron/tests/unit/sriovnicagent/test_sriov_agent_config.py with 100% similarity]
neutron/tests/unit/plugins/sriovnicagent/test_sriov_neutron_agent.py [moved from neutron/tests/unit/sriovnicagent/test_sriov_neutron_agent.py with 100% similarity]
neutron/tests/unit/scheduler/__init__.py [new file with mode: 0644]
neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py [moved from neutron/tests/unit/test_dhcp_scheduler.py with 100% similarity]
neutron/tests/unit/scheduler/test_l3_agent_scheduler.py [moved from neutron/tests/unit/test_l3_schedulers.py with 99% similarity]
neutron/tests/unit/services/l3_router/test_l3_apic.py [moved from neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py with 98% similarity]
neutron/tests/unit/services/metering/agents/__init__.py [new file with mode: 0644]
neutron/tests/unit/services/metering/agents/test_metering_agent.py [moved from neutron/tests/unit/services/metering/test_metering_agent.py with 100% similarity]
neutron/tests/unit/services/metering/drivers/test_iptables.py [moved from neutron/tests/unit/services/metering/drivers/test_iptables_driver.py with 99% similarity]
neutron/tests/unit/services/metering/test_metering_plugin.py
neutron/tests/unit/services/test_provider_configuration.py [moved from neutron/tests/unit/test_provider_configuration.py with 100% similarity]
neutron/tests/unit/test_context.py [moved from neutron/tests/unit/test_neutron_context.py with 100% similarity]
neutron/tests/unit/test_ipam.py [moved from neutron/tests/unit/ipam/test_ipam.py with 100% similarity]
neutron/tests/unit/test_manager.py [moved from neutron/tests/unit/test_neutron_manager.py with 96% similarity]
neutron/tests/unit/tests/__init__.py [new file with mode: 0644]
neutron/tests/unit/tests/test_base.py [moved from neutron/tests/unit/test_basetestcase.py with 100% similarity]
neutron/tests/unit/tests/test_post_mortem_debug.py [moved from neutron/tests/unit/test_post_mortem_debug.py with 100% similarity]
setup.cfg
tools/check_unit_test_structure.sh [new file with mode: 0755]
tools/misc-sanity-checks.sh
tox.ini

index 7b1d9f23698fb253e31e02ccabcbb1d912165415..a4f1388d020763f712c6110a43a92eae3e2dbe1e 100644 (file)
@@ -24,6 +24,39 @@ fixes that are submitted also have tests to prove that they stay
 fixed!  In addition, before proposing for merge, all of the
 current tests should be passing.
 
+Structure of the unit test tree
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The structure of the unit test tree should match the structure of the
+code tree, e.g. ::
+
+ - target module: neutron.agent.utils
+
+ - test module: neutron.tests.unit.agent.test_utils
+
+Unit test modules should have the same path under neutron/tests/unit/
+as the module they target has under neutron/, and their name should be
+the name of the target module prefixed by 'test_'.  This requirement
+is intended to make it easier for developers to find the unit tests
+for a given module.
+
+Similarly, when a test module targets a package, that module's name
+should be the name of the package prefixed by 'test_' with the same
+path as when a test targets a module, e.g. ::
+
+ - target package: neutron.ipam
+
+ - test module: neutron.tests.unit.test_ipam
+
+The following command can be used to validate whether the unit test
+tree is structured according to the above requirements: ::
+
+    ./tools/check_unit_test_structure.sh
+
+Where appropriate, exceptions can be added to the above script.  If
+code is not part of the neutron namespace, for example, it's probably
+reasonable to exclude their unit tests from the check.
+
 Virtual environments
 ~~~~~~~~~~~~~~~~~~~~
 
index 664c3094999c30f165a04ed3ca15e79e0d930a47..59dd9152f14d87f4051776fde596a5e00fb938b5 100644 (file)
@@ -5,4 +5,4 @@ pipeline = extensions extensions_test_app
 paste.filter_factory = neutron.common.extensions:plugin_aware_extension_middleware_factory
 
 [app:extensions_test_app]
-paste.app_factory = neutron.tests.unit.test_extensions:app_factory
+paste.app_factory = neutron.tests.unit.api.test_extensions:app_factory
index 874dc8d8b369624829837cc75326ad9f4630899d..a149f961c34d57f5a8a7c22c92abc9573a067001 100644 (file)
@@ -29,7 +29,7 @@ import testscenarios
 
 from neutron.tests import base as tests_base
 from neutron.tests.retargetable import client_fixtures
-from neutron.tests.unit.ml2 import test_ml2_plugin
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin
 
 
 # Each plugin must add a class to plugin_configurations that can configure the
index 39150cde588a893d6092547a4534f0fc79255575..1c2dac728e9bb035d33003ba95e387686a62fb5b 100644 (file)
@@ -22,10 +22,10 @@ from webob import exc
 from neutron import context
 from neutron.extensions import portbindings
 from neutron import manager
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
 
-class PortBindingsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
+class PortBindingsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     # VIF_TYPE must be overridden according to plugin vif_type
     VIF_TYPE = portbindings.VIF_TYPE_OTHER
similarity index 99%
rename from neutron/tests/unit/test_iptables_firewall.py
rename to neutron/tests/unit/agent/linux/test_iptables_firewall.py
index 8a22f827dae663b12708ff81b9aa49c76387048f..7de64135944b52b8bb3bba5370256c8b8f0bdfd9 100644 (file)
@@ -25,10 +25,10 @@ from neutron.agent.linux import iptables_firewall
 from neutron.agent import securitygroups_rpc as sg_cfg
 from neutron.common import constants
 from neutron.tests import base
-from neutron.tests.unit import test_api_v2
+from neutron.tests.unit.api.v2 import test_base
 
 
-_uuid = test_api_v2._uuid
+_uuid = test_base._uuid
 #TODO(mangelajo): replace all 'IPv4', 'IPv6' to constants
 FAKE_PREFIX = {'IPv4': '10.0.0.0/24',
                'IPv6': 'fe80::/48'}
similarity index 99%
rename from neutron/tests/unit/test_security_groups_rpc.py
rename to neutron/tests/unit/agent/test_securitygroups_rpc.py
index d15c883171ade738b9542fcaf84990ef648bc2c8..feabbcbfdbd4551012a79038e830b0ede0cdb2f2 100644 (file)
@@ -36,7 +36,7 @@ from neutron.extensions import allowedaddresspairs as addr_pair
 from neutron.extensions import securitygroup as ext_sg
 from neutron import manager
 from neutron.tests import base
-from neutron.tests.unit import test_extension_security_group as test_sg
+from neutron.tests.unit.extensions import test_securitygroup as test_sg
 
 FAKE_PREFIX = {const.IPv4: '10.0.0.0/24',
                const.IPv6: '2001:db8::/64'}
@@ -46,7 +46,7 @@ FAKE_IP = {const.IPv4: '10.0.0.1',
            'IPv6_LLA': 'fe80::123',
            'IPv6_DHCP': '2001:db8::3'}
 
-TEST_PLUGIN_CLASS = ('neutron.tests.unit.test_security_groups_rpc.'
+TEST_PLUGIN_CLASS = ('neutron.tests.unit.agent.test_securitygroups_rpc.'
                      'SecurityGroupRpcTestPlugin')
 
 
similarity index 99%
rename from neutron/tests/unit/test_extensions.py
rename to neutron/tests/unit/api/test_extensions.py
index ae533032b033f00d149b5f963cf84aae00c498fa..cbde52239aa6f0ba3dc8a9022c2919578d53ca6c 100644 (file)
@@ -35,17 +35,17 @@ from neutron.plugins.common import constants
 from neutron.plugins.ml2 import plugin as ml2_plugin
 from neutron import quota
 from neutron.tests import base
+from neutron.tests.unit.api.v2 import test_base
 from neutron.tests.unit import extension_stubs as ext_stubs
 import neutron.tests.unit.extensions
 from neutron.tests.unit.extensions import extendedattribute as extattr
-from neutron.tests.unit import test_api_v2
 from neutron.tests.unit import testlib_api
 from neutron import wsgi
 
 
 LOG = logging.getLogger(__name__)
-_uuid = test_api_v2._uuid
-_get_path = test_api_v2._get_path
+_uuid = test_base._uuid
+_get_path = test_base._get_path
 extensions_path = ':'.join(neutron.tests.unit.extensions.__path__)
 
 
@@ -721,7 +721,7 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase):
     def setUp(self):
         super(ExtensionExtendedAttributeTestCase, self).setUp()
         plugin = (
-            "neutron.tests.unit.test_extensions."
+            "neutron.tests.unit.api.test_extensions."
             "ExtensionExtendedAttributeTestPlugin"
         )
 
similarity index 99%
rename from neutron/tests/unit/test_api_v2.py
rename to neutron/tests/unit/api/v2/test_base.py
index c4b706bd5ab26474da61593e8d0c1fc51c79e515..a12eaec7aa54d8e7731fca102a2d98e8b85f7745 100644 (file)
@@ -1105,7 +1105,7 @@ class SubresourceTest(base.BaseTestCase):
     def setUp(self):
         super(SubresourceTest, self).setUp()
 
-        plugin = 'neutron.tests.unit.test_api_v2.TestSubresourcePlugin'
+        plugin = 'neutron.tests.unit.api.v2.test_base.TestSubresourcePlugin'
         extensions.PluginAwareExtensionManager._instance = None
 
         # Save the global RESOURCE_ATTRIBUTE_MAP
similarity index 98%
rename from neutron/tests/unit/db/metering/test_db_metering.py
rename to neutron/tests/unit/db/metering/test_metering_db.py
index 56c36d802d6279a1de71ceb818201a9d0472a343..bd513696b33fcfdb39fe1218fe8f589fc11b3598 100644 (file)
@@ -24,7 +24,7 @@ import neutron.extensions
 from neutron.extensions import metering
 from neutron.plugins.common import constants
 from neutron.services.metering import metering_plugin
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
 DB_METERING_PLUGIN_KLASS = (
     "neutron.services.metering."
@@ -108,8 +108,9 @@ class MeteringPluginDbTestCaseMixin(object):
         yield metering_label_rule
 
 
-class MeteringPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
-                               MeteringPluginDbTestCaseMixin):
+class MeteringPluginDbTestCase(
+        test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
+        MeteringPluginDbTestCaseMixin):
     fmt = 'json'
 
     resource_prefix_map = dict(
similarity index 98%
rename from neutron/tests/unit/test_extension_allowedaddresspairs.py
rename to neutron/tests/unit/db/test_allowedaddresspairs_db.py
index 4f740b64474a468da7b31adc911295ba2ad67b80..6185d2e18803f2297cec3bd40130be716d1f89ed 100644 (file)
@@ -22,15 +22,16 @@ from neutron.extensions import allowedaddresspairs as addr_pair
 from neutron.extensions import portsecurity as psec
 from neutron.extensions import securitygroup as secgroup
 from neutron import manager
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 from oslo_config import cfg
 
 
-DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_allowedaddresspairs.'
+DB_PLUGIN_KLASS = ('neutron.tests.unit.db.test_allowedaddresspairs_db.'
                    'AllowedAddressPairTestPlugin')
 
 
-class AllowedAddressPairTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
+class AllowedAddressPairTestCase(
+        test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
     def setUp(self, plugin=None, ext_mgr=None):
         super(AllowedAddressPairTestCase, self).setUp(plugin)
 
similarity index 99%
rename from neutron/tests/unit/test_db_plugin.py
rename to neutron/tests/unit/db/test_db_base_plugin_v2.py
index 8a5393b4939294af7c180c4e95fd557a3438fb58..5db1570ef7cada9fe38a1cb3748090d0d7062478 100644 (file)
@@ -39,7 +39,7 @@ from neutron.db import db_base_plugin_v2
 from neutron.db import models_v2
 from neutron import manager
 from neutron.tests import base
-from neutron.tests.unit import test_extensions
+from neutron.tests.unit.api import test_extensions
 from neutron.tests.unit import testlib_api
 
 DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
similarity index 96%
rename from neutron/tests/unit/test_api_v2_extension.py
rename to neutron/tests/unit/extensions/base.py
index 8ead1f919e88927716781b1ff46dde5e16f9614c..2fa03024e861efd9f4b8ba6def83a164dc5e9728 100644 (file)
@@ -26,8 +26,8 @@ import webtest
 from neutron.api import extensions
 from neutron.api.v2 import attributes
 from neutron import quota
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_extensions
+from neutron.tests.unit.api import test_extensions
+from neutron.tests.unit.api.v2 import test_base
 from neutron.tests.unit import testlib_api
 
 
@@ -117,7 +117,7 @@ class ExtensionTestCase(testlib_api.WebTestCase):
         if self._translate_resource_name:
             path = path.replace('_', '-')
         res = self.api.delete(
-            test_api_v2._get_path(path, id=entity_id, fmt=self.fmt))
+            test_base._get_path(path, id=entity_id, fmt=self.fmt))
         delete_entity = getattr(self.plugin.return_value, "delete_" + entity)
         delete_entity.assert_called_with(mock.ANY, entity_id)
         self.assertEqual(res.status_int, exc.HTTPNoContent.code)
similarity index 97%
rename from neutron/tests/unit/test_agent_ext_plugin.py
rename to neutron/tests/unit/extensions/test_agent.py
index af925208b4c3be0b744b3884d3547b7c1c7e8ee9..f3bcb5c34556705d8a22e0346b24e37a75f36591 100644 (file)
@@ -29,14 +29,14 @@ from neutron.db import agents_db
 from neutron.db import db_base_plugin_v2
 from neutron.extensions import agent
 from neutron.openstack.common import uuidutils
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
 
 LOG = logging.getLogger(__name__)
 
 _uuid = uuidutils.generate_uuid
-_get_path = test_api_v2._get_path
+_get_path = test_base._get_path
 L3_HOSTA = 'hosta'
 DHCP_HOSTA = 'hosta'
 L3_HOSTB = 'hostb'
@@ -180,11 +180,11 @@ class AgentDBTestMixIn(object):
 
 
 class AgentDBTestCase(AgentDBTestMixIn,
-                      test_db_plugin.NeutronDbPluginV2TestCase):
+                      test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
     fmt = 'json'
 
     def setUp(self):
-        plugin = 'neutron.tests.unit.test_agent_ext_plugin.TestAgentPlugin'
+        plugin = 'neutron.tests.unit.extensions.test_agent.TestAgentPlugin'
         # for these tests we need to enable overlapping ips
         cfg.CONF.set_default('allow_overlapping_ips', True)
         # Save the original RESOURCE_ATTRIBUTE_MAP
similarity index 96%
rename from neutron/tests/unit/test_extension_ext_net.py
rename to neutron/tests/unit/extensions/test_external_net.py
index 6cb0f1fb9d4ff6b9d418bae610488d4c7ddc0112..b2ccce818e3a493c22fe461276dcacacaa6575a1 100644 (file)
@@ -26,14 +26,14 @@ from neutron.db import models_v2
 from neutron.extensions import external_net as external_net
 from neutron import manager
 from neutron.openstack.common import uuidutils
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
 
 LOG = logging.getLogger(__name__)
 
 _uuid = uuidutils.generate_uuid
-_get_path = test_api_v2._get_path
+_get_path = test_base._get_path
 
 
 class ExtNetTestExtensionManager(object):
@@ -48,7 +48,7 @@ class ExtNetTestExtensionManager(object):
         return []
 
 
-class ExtNetDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
+class ExtNetDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     def _create_network(self, fmt, name, admin_state_up, **kwargs):
         """Override the routine for allowing the router:external attribute."""
@@ -62,7 +62,7 @@ class ExtNetDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
             fmt, name, admin_state_up, arg_list=arg_list, **new_args)
 
     def setUp(self):
-        plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin'
+        plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin'
         ext_mgr = ExtNetTestExtensionManager()
         super(ExtNetDBTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
 
similarity index 98%
rename from neutron/tests/unit/test_extension_extradhcpopts.py
rename to neutron/tests/unit/extensions/test_extra_dhcp_opt.py
index 03fe2a377f0fcdb863328d691cddbb67b0b5677a..68ecd748d95f1493de6379aa11881c79808b0cf0 100644 (file)
@@ -21,12 +21,12 @@ import webob.exc
 from neutron.db import db_base_plugin_v2
 from neutron.db import extradhcpopt_db as edo_db
 from neutron.extensions import extra_dhcp_opt as edo_ext
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
 LOG = logging.getLogger(__name__)
 
 DB_PLUGIN_KLASS = (
-    'neutron.tests.unit.test_extension_extradhcpopts.ExtraDhcpOptTestPlugin')
+    'neutron.tests.unit.extensions.test_extra_dhcp_opt.ExtraDhcpOptTestPlugin')
 
 
 class ExtraDhcpOptTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
@@ -53,7 +53,7 @@ class ExtraDhcpOptTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
         return rtn_port
 
 
-class ExtraDhcpOptDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
+class ExtraDhcpOptDBTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     def setUp(self, plugin=DB_PLUGIN_KLASS):
         super(ExtraDhcpOptDBTestCase, self).setUp(plugin=plugin)
similarity index 98%
rename from neutron/tests/unit/test_extension_extraroute.py
rename to neutron/tests/unit/extensions/test_extraroute.py
index ece89c0662f7c6306d9eb85ba8bc233ffde03487..78e555f0b54bbc3b391621a4ecce56121221b364 100644 (file)
@@ -24,14 +24,14 @@ from neutron.db import extraroute_db
 from neutron.extensions import extraroute
 from neutron.extensions import l3
 from neutron.openstack.common import uuidutils
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_l3_plugin as test_l3
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.extensions import test_l3 as test_l3
 
 
 LOG = logging.getLogger(__name__)
 
 _uuid = uuidutils.generate_uuid
-_get_path = test_api_v2._get_path
+_get_path = test_base._get_path
 
 
 class ExtraRouteTestExtensionManager(object):
@@ -459,7 +459,7 @@ class ExtraRouteDBIntTestCase(test_l3.L3NatDBIntTestCase,
 
     def setUp(self, plugin=None, ext_mgr=None):
         if not plugin:
-            plugin = ('neutron.tests.unit.test_extension_extraroute.'
+            plugin = ('neutron.tests.unit.extensions.test_extraroute.'
                       'TestExtraRouteIntPlugin')
         # for these tests we need to enable overlapping ips
         cfg.CONF.set_default('allow_overlapping_ips', True)
@@ -474,9 +474,9 @@ class ExtraRouteDBSepTestCase(test_l3.L3NatDBSepTestCase,
                               ExtraRouteDBTestCaseBase):
     def setUp(self):
         # the plugin without L3 support
-        plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin'
+        plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin'
         # the L3 service plugin
-        l3_plugin = ('neutron.tests.unit.test_extension_extraroute.'
+        l3_plugin = ('neutron.tests.unit.extensions.test_extraroute.'
                      'TestExtraRouteL3NatServicePlugin')
         service_plugins = {'l3_plugin_name': l3_plugin}
 
similarity index 99%
rename from neutron/tests/unit/test_l3_plugin.py
rename to neutron/tests/unit/extensions/test_l3.py
index cdc883055daf8420b262be081d8d3ff0e80f3587..8c824d6c07831049220a95ee7c9569ada500c07d 100644 (file)
@@ -47,15 +47,15 @@ from neutron.openstack.common import uuidutils
 from neutron.plugins.common import constants as service_constants
 from neutron.tests import base
 from neutron.tests import fake_notifier
-from neutron.tests.unit import test_agent_ext_plugin
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_api_v2_extension
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.db import test_db_base_plugin_v2
+from neutron.tests.unit.extensions import base as test_extensions_base
+from neutron.tests.unit.extensions import test_agent
 
 LOG = logging.getLogger(__name__)
 
 _uuid = uuidutils.generate_uuid
-_get_path = test_api_v2._get_path
+_get_path = test_base._get_path
 
 
 class L3TestExtensionManager(object):
@@ -76,7 +76,7 @@ class L3TestExtensionManager(object):
         return []
 
 
-class L3NatExtensionTestCase(test_api_v2_extension.ExtensionTestCase):
+class L3NatExtensionTestCase(test_extensions_base.ExtensionTestCase):
     fmt = 'json'
 
     def setUp(self):
@@ -464,7 +464,7 @@ class L3NatTestCaseMixin(object):
             private_port = None
             if port_id:
                 private_port = self._show('ports', port_id)
-            with test_db_plugin.optional_ctx(private_port,
+            with test_db_base_plugin_v2.optional_ctx(private_port,
                                              self.port) as private_port:
                 with self.router() as r:
                     sid = private_port['port']['fixed_ips'][0]['subnet_id']
@@ -2431,13 +2431,13 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin):
         self._test_notify_op_agent(self._test_floatingips_op_agent)
 
 
-class L3BaseForIntTests(test_db_plugin.NeutronDbPluginV2TestCase):
+class L3BaseForIntTests(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     mock_rescheduling = True
 
     def setUp(self, plugin=None, ext_mgr=None, service_plugins=None):
         if not plugin:
-            plugin = 'neutron.tests.unit.test_l3_plugin.TestL3NatIntPlugin'
+            plugin = 'neutron.tests.unit.extensions.test_l3.TestL3NatIntPlugin'
         # for these tests we need to enable overlapping ips
         cfg.CONF.set_default('allow_overlapping_ips', True)
         ext_mgr = ext_mgr or L3TestExtensionManager()
@@ -2452,14 +2452,14 @@ class L3BaseForIntTests(test_db_plugin.NeutronDbPluginV2TestCase):
         self.setup_notification_driver()
 
 
-class L3BaseForSepTests(test_db_plugin.NeutronDbPluginV2TestCase):
+class L3BaseForSepTests(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     def setUp(self, plugin=None, ext_mgr=None):
         # the plugin without L3 support
         if not plugin:
-            plugin = 'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin'
+            plugin = 'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin'
         # the L3 service plugin
-        l3_plugin = ('neutron.tests.unit.test_l3_plugin.'
+        l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
                      'TestL3NatServicePlugin')
         service_plugins = {'l3_plugin_name': l3_plugin}
 
@@ -2475,12 +2475,12 @@ class L3BaseForSepTests(test_db_plugin.NeutronDbPluginV2TestCase):
 
 class L3NatDBIntAgentSchedulingTestCase(L3BaseForIntTests,
                                         L3NatTestCaseMixin,
-                                        test_agent_ext_plugin.
+                                        test_agent.
                                         AgentDBTestMixIn):
 
     """Unit tests for core plugin with L3 routing and scheduling integrated."""
 
-    def setUp(self, plugin='neutron.tests.unit.test_l3_plugin.'
+    def setUp(self, plugin='neutron.tests.unit.extensions.test_l3.'
                            'TestL3NatIntAgentSchedulingPlugin',
               ext_mgr=None, service_plugins=None):
         self.mock_rescheduling = False
similarity index 96%
rename from neutron/tests/unit/test_extension_ext_gw_mode.py
rename to neutron/tests/unit/extensions/test_l3_ext_gw_mode.py
index 8ca7a2bee31b71365d39d3f6a84c9612be81be80..291c88fcb66309f40724362c670f240a4c2c1085 100644 (file)
@@ -27,8 +27,8 @@ from neutron.db import models_v2
 from neutron.extensions import l3
 from neutron.extensions import l3_ext_gw_mode
 from neutron.openstack.common import uuidutils
-from neutron.tests.unit import test_db_plugin
-from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
+from neutron.tests.unit.extensions import test_l3
 from neutron.tests.unit import testlib_api
 
 _uuid = uuidutils.generate_uuid
@@ -60,7 +60,7 @@ class TestExtensionManager(object):
 
 # A simple class for making a concrete class out of the mixin
 # for the case of a plugin that integrates l3 routing.
-class TestDbIntPlugin(test_l3_plugin.TestL3NatIntPlugin,
+class TestDbIntPlugin(test_l3.TestL3NatIntPlugin,
                       l3_gwmode_db.L3_NAT_db_mixin):
 
     supported_extension_aliases = ["external-net", "router", "ext-gw-mode"]
@@ -68,7 +68,7 @@ class TestDbIntPlugin(test_l3_plugin.TestL3NatIntPlugin,
 
 # A simple class for making a concrete class out of the mixin
 # for the case of a l3 router service plugin
-class TestDbSepPlugin(test_l3_plugin.TestL3NatServicePlugin,
+class TestDbSepPlugin(test_l3.TestL3NatServicePlugin,
                       l3_gwmode_db.L3_NAT_db_mixin):
 
     supported_extension_aliases = ["router", "ext-gw-mode"]
@@ -299,8 +299,8 @@ class TestL3GwModeMixin(testlib_api.SqlTestCase):
         self.assertIsNone(router.get('enable_snat'))
 
 
-class ExtGwModeIntTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
-                           test_l3_plugin.L3NatTestCaseMixin):
+class ExtGwModeIntTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
+                           test_l3.L3NatTestCaseMixin):
 
     def setUp(self, plugin=None, svc_plugins=None, ext_mgr=None):
         # Store l3 resource attribute map as it will be updated
@@ -309,7 +309,8 @@ class ExtGwModeIntTestCase(test_db_plugin.NeutronDbPluginV2TestCase,
             self._l3_attribute_map_bk[item] = (
                 l3.RESOURCE_ATTRIBUTE_MAP[item].copy())
         plugin = plugin or (
-            'neutron.tests.unit.test_extension_ext_gw_mode.TestDbIntPlugin')
+            'neutron.tests.unit.extensions.test_l3_ext_gw_mode.'
+            'TestDbIntPlugin')
         # for these tests we need to enable overlapping ips
         cfg.CONF.set_default('allow_overlapping_ips', True)
         ext_mgr = ext_mgr or TestExtensionManager()
@@ -430,9 +431,9 @@ class ExtGwModeSepTestCase(ExtGwModeIntTestCase):
             self._l3_attribute_map_bk[item] = (
                 l3.RESOURCE_ATTRIBUTE_MAP[item].copy())
         plugin = plugin or (
-            'neutron.tests.unit.test_l3_plugin.TestNoL3NatPlugin')
+            'neutron.tests.unit.extensions.test_l3.TestNoL3NatPlugin')
         # the L3 service plugin
-        l3_plugin = ('neutron.tests.unit.test_extension_ext_gw_mode.'
+        l3_plugin = ('neutron.tests.unit.extensions.test_l3_ext_gw_mode.'
                      'TestDbSepPlugin')
         svc_plugins = {'l3_plugin_name': l3_plugin}
         # for these tests we need to enable overlapping ips
similarity index 93%
rename from neutron/tests/unit/test_extension_netmtu.py
rename to neutron/tests/unit/extensions/test_netmtu.py
index ca57d7a052f071db22b6d93219ae9dd54d24a835..957adaef39e72bd01734af52a9b9b28058ad5708 100644 (file)
@@ -16,7 +16,7 @@ from neutron.common import constants
 from neutron.db import db_base_plugin_v2
 from neutron.db import netmtu_db
 from neutron.extensions import netmtu
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
 
 class NetmtuExtensionManager(object):
@@ -42,12 +42,12 @@ class NetmtuExtensionTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
     supported_extension_aliases = ["net-mtu"]
 
 
-class NetmtuExtensionTestCase(test_db_plugin.TestNetworksV2):
+class NetmtuExtensionTestCase(test_db_base_plugin_v2.TestNetworksV2):
     """Test API extension net-mtu attributes.
     """
 
     def setUp(self):
-        plugin = ('neutron.tests.unit.test_extension_netmtu.' +
+        plugin = ('neutron.tests.unit.extensions.test_netmtu.' +
                   'NetmtuExtensionTestPlugin')
         ext_mgr = NetmtuExtensionManager()
         super(NetmtuExtensionTestCase, self).setUp(plugin=plugin,
similarity index 98%
rename from neutron/tests/unit/test_extension_portsecurity.py
rename to neutron/tests/unit/extensions/test_portsecurity.py
index a7664058e7b8c742b957849867d91b6e64fa3b08..42d0c340cca3418a638c0c5ee6b5c2aa0503f9a2 100644 (file)
@@ -23,20 +23,20 @@ from neutron.db import securitygroups_db
 from neutron.extensions import portsecurity as psec
 from neutron.extensions import securitygroup as ext_sg
 from neutron import manager
-from neutron.tests.unit import test_db_plugin
-from neutron.tests.unit import test_extension_security_group
+from neutron.tests.unit.db import test_db_base_plugin_v2
+from neutron.tests.unit.extensions import test_securitygroup
 
-DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_portsecurity.'
+DB_PLUGIN_KLASS = ('neutron.tests.unit.extensions.test_portsecurity.'
                    'PortSecurityTestPlugin')
 
 
 class PortSecurityTestCase(
-    test_extension_security_group.SecurityGroupsTestCase,
-    test_db_plugin.NeutronDbPluginV2TestCase):
+    test_securitygroup.SecurityGroupsTestCase,
+    test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     def setUp(self, plugin=None):
         ext_mgr = (
-            test_extension_security_group.SecurityGroupTestExtensionManager())
+            test_securitygroup.SecurityGroupTestExtensionManager())
         super(PortSecurityTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
 
         # Check if a plugin supports security groups
similarity index 94%
rename from neutron/tests/unit/test_extension_pnet.py
rename to neutron/tests/unit/extensions/test_providernet.py
index 293d50f0a5f2088fe1bb771977aede5b48f34add..b55eb44d95d45927e8cfdad2eed2e7a0f800282c 100644 (file)
@@ -26,8 +26,8 @@ from neutron.extensions import providernet as pnet
 from neutron import manager
 from neutron.openstack.common import uuidutils
 from neutron import quota
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_extensions
+from neutron.tests.unit.api import test_extensions
+from neutron.tests.unit.api.v2 import test_base
 from neutron.tests.unit import testlib_api
 
 
@@ -101,9 +101,9 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
         instance.get_network.return_value = {'tenant_id': ctx.tenant_id,
                                              'shared': False}
         net_id = uuidutils.generate_uuid()
-        res = self.api.put(test_api_v2._get_path('networks',
-                                                 id=net_id,
-                                                 fmt=self.fmt),
+        res = self.api.put(test_base._get_path('networks',
+                                               id=net_id,
+                                               fmt=self.fmt),
                            self.serialize({'network': data}),
                            extra_environ=env,
                            expect_errors=expect_errors)
@@ -112,7 +112,7 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
     def _post_network_with_provider_attrs(self, ctx, expect_errors=False):
         data = self._prepare_net_data()
         env = {'neutron.context': ctx}
-        res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt),
+        res = self.api.post(test_base._get_path('networks', fmt=self.fmt),
                             self.serialize({'network': data}),
                             content_type='application/' + self.fmt,
                             extra_environ=env,
@@ -124,7 +124,7 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
         data = self._prepare_net_data()
         data.update(bad_data)
         env = {'neutron.context': ctx}
-        res = self.api.post(test_api_v2._get_path('networks', fmt=self.fmt),
+        res = self.api.post(test_base._get_path('networks', fmt=self.fmt),
                             self.serialize({'network': data}),
                             content_type='application/' + self.fmt,
                             extra_environ=env,
similarity index 99%
rename from neutron/tests/unit/test_quota_ext.py
rename to neutron/tests/unit/extensions/test_quotasv2.py
index 257445bd717cc689e1715872c0294c20616486d2..349706b5580639bb1604ff6a232fc5d29ee14031 100644 (file)
@@ -30,12 +30,12 @@ from neutron import context
 from neutron.db import quota_db
 from neutron import quota
 from neutron.tests import base
-from neutron.tests.unit import test_api_v2
+from neutron.tests.unit.api.v2 import test_base
 from neutron.tests.unit import testlib_api
 
 TARGET_PLUGIN = 'neutron.plugins.ml2.plugin.Ml2Plugin'
 
-_get_path = test_api_v2._get_path
+_get_path = test_base._get_path
 
 
 class QuotaExtensionTestCase(testlib_api.WebTestCase):
similarity index 99%
rename from neutron/tests/unit/test_extension_security_group.py
rename to neutron/tests/unit/extensions/test_securitygroup.py
index 2a401bcc9eb81e7dc09a7c04afd75c91b3632b5c..4f9533a5f35f3bc4539e06bedd70ca0d3846e3cf 100644 (file)
@@ -29,9 +29,9 @@ from neutron.db import securitygroups_db
 from neutron.extensions import securitygroup as ext_sg
 from neutron import manager
 from neutron.tests import base
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 
-DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_security_group.'
+DB_PLUGIN_KLASS = ('neutron.tests.unit.extensions.test_securitygroup.'
                    'SecurityGroupTestPlugin')
 
 
@@ -53,7 +53,7 @@ class SecurityGroupTestExtensionManager(object):
         return []
 
 
-class SecurityGroupsTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
+class SecurityGroupsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
 
     def _create_security_group(self, fmt, name, description, **kwargs):
 
similarity index 96%
rename from neutron/tests/unit/test_servicetype.py
rename to neutron/tests/unit/extensions/test_servicetype.py
index 6ca841aa306097f403a2f61934306d34c5092b99..cc834ffe5b4af11b46b0ece81255de1441f1d22b 100644 (file)
@@ -25,18 +25,18 @@ from neutron.db import servicetype_db as st_db
 from neutron.extensions import servicetype
 from neutron.plugins.common import constants
 from neutron.services import provider_configuration as provconf
+from neutron.tests.unit.api import test_extensions
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.db import test_db_base_plugin_v2
 from neutron.tests.unit import dummy_plugin as dp
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_db_plugin
-from neutron.tests.unit import test_extensions
 from neutron.tests.unit import testlib_api
 
 
 DEFAULT_SERVICE_DEFS = [{'service_class': constants.DUMMY,
                          'plugin': dp.DUMMY_PLUGIN_NAME}]
 
-_uuid = test_api_v2._uuid
-_get_path = test_api_v2._get_path
+_uuid = test_base._uuid
+_get_path = test_base._get_path
 
 
 class ServiceTypeManagerTestCase(testlib_api.SqlTestCase):
@@ -165,7 +165,7 @@ class ServiceTypeExtensionTestCaseBase(testlib_api.WebTestCase):
     def setUp(self):
         # This is needed because otherwise a failure will occur due to
         # nonexisting core_plugin
-        self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS)
+        self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS)
 
         cfg.CONF.set_override('service_plugins',
                               ["%s.%s" % (dp.__name__,
index a0fc85d82b40e74e25e75edfba2f4c7460022a29..592fca00477b70994d14b417608497ecf72804f9 100644 (file)
@@ -24,7 +24,7 @@ import neutron.ipam as ipam
 from neutron.ipam import subnet_alloc
 from neutron import manager
 from neutron.openstack.common import uuidutils
-from neutron.tests.unit import test_db_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
 from neutron.tests.unit import testlib_api
 
 
@@ -33,7 +33,7 @@ class TestSubnetAllocation(testlib_api.SqlTestCase):
     def setUp(self):
         super(TestSubnetAllocation, self).setUp()
         self._tenant_id = 'test-tenant'
-        self.setup_coreplugin(test_db_plugin.DB_PLUGIN_KLASS)
+        self.setup_coreplugin(test_db_base_plugin_v2.DB_PLUGIN_KLASS)
         self.plugin = manager.NeutronManager.get_plugin()
         self.ctx = context.get_admin_context()
         cfg.CONF.set_override('allow_overlapping_ips', True)
similarity index 98%
rename from neutron/tests/unit/brocade/test_brocade_db.py
rename to neutron/tests/unit/plugins/brocade/test_brocade_db.py
index 1733dc4c15ce6015dcaf03c8ee5546ec7e4ae63c..99d5b3fb9b0cdb539ab5f834058986d4ec852c4e 100644 (file)
@@ -21,7 +21,7 @@ import uuid
 
 from neutron import context
 from neutron.plugins.brocade.db import models as brocade_db
-from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
 
 TEST_VLAN = 1000
 
similarity index 97%
rename from neutron/tests/unit/brocade/test_brocade_plugin.py
rename to neutron/tests/unit/plugins/brocade/test_brocade_plugin.py
index ea2f0f83d436ef8c6f94667ab087a5b570cad2fc..bccff29b7471391d08d627f4dc54d3fd1031d1ee 100644 (file)
@@ -20,7 +20,7 @@ from oslo_utils import importutils
 from neutron.extensions import portbindings
 from neutron.plugins.brocade import NeutronPlugin as brocade_plugin
 from neutron.tests.unit import _test_extension_portbindings as test_bindings
-from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
 
 
 PLUGIN_NAME = ('neutron.plugins.brocade.'
similarity index 99%
rename from neutron/tests/unit/cisco/n1kv/test_n1kv_db.py
rename to neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_db.py
index 434250e2a9d9e24083a4d38dfc883936e58ec4ed..eadc4b4a3d0bd3657dfff763a84ebfd8be3e8c0a 100644 (file)
@@ -24,7 +24,7 @@ from neutron.plugins.cisco.common import cisco_constants as c_const
 from neutron.plugins.cisco.common import cisco_exceptions as c_exc
 from neutron.plugins.cisco.db import n1kv_db_v2
 from neutron.plugins.cisco.db import n1kv_models_v2
-from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
 from neutron.tests.unit import testlib_api
 
 
similarity index 99%
rename from neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py
rename to neutron/tests/unit/plugins/cisco/n1kv/test_n1kv_plugin.py
index 224883a983db7fd9a07f637d56e906f27b8b86df..b388e083fc9f935ce5d4391ba39f7840195d8571 100644 (file)
@@ -34,11 +34,11 @@ from neutron.plugins.cisco.extensions import policy_profile
 from neutron.plugins.cisco.n1kv import n1kv_client
 from neutron.plugins.cisco.n1kv import n1kv_neutron_plugin
 from neutron.tests.unit import _test_extension_portbindings as test_bindings
-from neutron.tests.unit.cisco.n1kv import fake_client
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_db_plugin as test_plugin
-from neutron.tests.unit import test_l3_plugin
-from neutron.tests.unit import test_l3_schedulers
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
+from neutron.tests.unit.extensions import test_l3
+from neutron.tests.unit.plugins.cisco.n1kv import fake_client
+from neutron.tests.unit.scheduler import test_l3_agent_scheduler
 
 
 PHYS_NET = 'some-phys-net'
@@ -128,7 +128,7 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
                      create. Default argument value chosen to correspond to the
                      default name specified in config.py file.
         """
-        uuid = test_api_v2._uuid()
+        uuid = test_base._uuid()
         profile = {'id': uuid,
                    'name': name}
         return n1kv_db_v2.create_policy_profile(profile)
@@ -1281,11 +1281,11 @@ class TestN1kvSubnets(test_plugin.TestSubnetsV2,
         self.assertEqual(1, mock_method.call_count)
 
 
-class TestN1kvL3Test(test_l3_plugin.L3NatExtensionTestCase):
+class TestN1kvL3Test(test_l3.L3NatExtensionTestCase):
 
     pass
 
 
-class TestN1kvL3SchedulersTest(test_l3_schedulers.L3SchedulerTestCase):
+class TestN1kvL3SchedulersTest(test_l3_agent_scheduler.L3SchedulerTestCase):
 
     pass
similarity index 93%
rename from neutron/tests/unit/embrane/test_embrane_l3_plugin.py
rename to neutron/tests/unit/plugins/embrane/test_embrane_l3_plugin.py
index 83495afac2fcc963ed3e970b07ba0ac1b059804c..b578d1c956dceadaf66e92b2cd19e3aa5e72da3c 100644 (file)
@@ -16,7 +16,7 @@
 from oslo_config import cfg
 
 from neutron.plugins.embrane.common import config  # noqa
-from neutron.tests.unit import test_extension_extraroute as extraroute_test
+from neutron.tests.unit.extensions import test_extraroute as extraroute_test
 
 PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
                'EmbraneFakePlugin')
similarity index 97%
rename from neutron/tests/unit/embrane/test_embrane_neutron_plugin.py
rename to neutron/tests/unit/plugins/embrane/test_embrane_neutron_plugin.py
index cf68c5fd75dfc68e84a2f8cef6b773787c04ebdc..8ac9d341f3d7bf5f08b9c662092cf3449befd34b 100644 (file)
@@ -18,7 +18,7 @@ import mock
 from oslo_config import cfg
 
 from neutron.plugins.embrane.common import config  # noqa
-from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
 
 PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
                'EmbraneFakePlugin')
similarity index 94%
rename from neutron/tests/unit/ibm/test_sdnve_plugin.py
rename to neutron/tests/unit/plugins/ibm/test_sdnve_plugin.py
index 82ba6181f19702958816867affe7f2917b7a2f4e..525468f157e69bd8f340df3bbb75f8d874f43030 100644 (file)
@@ -20,8 +20,8 @@ import mock
 
 from neutron.extensions import portbindings
 from neutron.tests.unit import _test_extension_portbindings as test_bindings
-from neutron.tests.unit import test_db_plugin as test_plugin
-from neutron.tests.unit import test_l3_plugin as test_l3_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
+from neutron.tests.unit.extensions import test_l3 as test_l3
 
 from neutron.plugins.ibm.common import constants
 
@@ -111,7 +111,7 @@ class TestIBMPortBinding(IBMPluginV2TestCase,
     VIF_TYPE = portbindings.VIF_TYPE_OVS
 
 
-class IBMPluginRouterTestCase(test_l3_plugin.L3NatDBIntTestCase):
+class IBMPluginRouterTestCase(test_l3.L3NatDBIntTestCase):
 
     def setUp(self):
         with contextlib.nested(
similarity index 99%
rename from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py
rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_mechanism_driver.py
index 4459e9d49906419dc3aad69fb3b4bb42b70a5f44..50cba5fc801ec971be7a018893b1d822e9aec9df 100644 (file)
@@ -24,7 +24,7 @@ from neutron.extensions import portbindings
 from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic as md
 from neutron.plugins.ml2.drivers import type_vlan  # noqa
 from neutron.tests import base
-from neutron.tests.unit.ml2.drivers.cisco.apic import (
+from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import (
     test_cisco_apic_common as mocked)
 
 
similarity index 99%
rename from neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py
rename to neutron/tests/unit/plugins/ml2/drivers/cisco/apic/test_cisco_apic_topology_agent.py
index 895d3cdfa45b74baea7738ab8df6661188acf1ad..89fefbaeacde38963af1c23a2b063f24c1718042 100644 (file)
@@ -21,7 +21,7 @@ sys.modules["apicapi"] = mock.Mock()
 
 from neutron.plugins.ml2.drivers.cisco.apic import apic_topology
 from neutron.tests import base
-from neutron.tests.unit.ml2.drivers.cisco.apic import (
+from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import (
     test_cisco_apic_common as mocked)
 
 NOTIFIER = ('neutron.plugins.ml2.drivers.cisco.apic.'
similarity index 95%
rename from neutron/tests/unit/ml2/drivers/cisco/ncs/test_mechanism_ncs.py
rename to neutron/tests/unit/plugins/ml2/drivers/cisco/ncs/test_mechanism_ncs.py
index 7aa99035825be54df341980cec4c60bbb45f9b52..d9fe09ad2266a4800379cdbb97d021a41b05871b 100644 (file)
@@ -14,7 +14,7 @@
 #    under the License.
 
 from neutron.plugins.ml2.drivers.cisco.ncs import driver
-from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin
 
 
 class NCSTestCase(test_plugin.Ml2PluginV2TestCase):
similarity index 99%
rename from neutron/tests/unit/ml2/drivers/ext_test.py
rename to neutron/tests/unit/plugins/ml2/drivers/ext_test.py
index 45fa4fde938543f87f08a4b46a1cd7b074805ba0..02b79dc585f54ad3e32925454495ef4783f0d33d 100644 (file)
@@ -26,7 +26,7 @@ from neutron.api.v2 import attributes
 from neutron.db import model_base
 from neutron.db import models_v2
 from neutron.plugins.ml2 import driver_api
-from neutron.tests.unit.ml2 import extensions as test_extensions
+from neutron.tests.unit.plugins.ml2 import extensions as test_extensions
 
 
 class TestExtensionDriverBase(driver_api.ExtensionDriver):
similarity index 99%
rename from neutron/tests/unit/ml2/drivers/freescale/test_mechanism_fslsdn.py
rename to neutron/tests/unit/plugins/ml2/drivers/freescale/test_mechanism_fslsdn.py
index 40c881488c290b255c5e6fd1bed5ee71aa793840..04b0e8fb129696cb65e56303a4e7f0c45513308a 100644 (file)
@@ -19,7 +19,7 @@ from oslo_config import cfg
 from neutron.extensions import portbindings
 from neutron.plugins.ml2.drivers.freescale import mechanism_fslsdn
 from neutron.tests import base
-from neutron.tests.unit.ml2 import test_ml2_plugin
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin
 
 
 """Unit testing for Freescale SDN mechanism driver."""
similarity index 99%
rename from neutron/tests/unit/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py
rename to neutron/tests/unit/plugins/ml2/drivers/mech_sriov/test_mech_sriov_nic_switch.py
index 14dffd4d333cc6b74397f48ded1c253e5fd71ced..5a866c7c4b702b83925a316aa831d1de0c22ee41 100644 (file)
@@ -24,7 +24,7 @@ from neutron.plugins.ml2 import config  # noqa
 from neutron.plugins.ml2 import driver_api as api
 from neutron.plugins.ml2.drivers.mech_sriov import exceptions as exc
 from neutron.plugins.ml2.drivers.mech_sriov import mech_driver
-from neutron.tests.unit.ml2 import _test_mech_agent as base
+from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
 
 MELLANOX_CONNECTX3_PCI_INFO = '15b3:1004'
 DEFAULT_PCI_INFO = ['15b3:1004', '8086:10ca']
similarity index 99%
rename from neutron/tests/unit/ml2/drivers/test_l2population.py
rename to neutron/tests/unit/plugins/ml2/drivers/test_l2population.py
index 5b57c9e41d5110efcb08482992e15d326487883f..d0f972158123f5816e802a4fd2509860fc5a780f 100644 (file)
@@ -35,7 +35,7 @@ from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
 from neutron.plugins.ml2 import managers
 from neutron.plugins.ml2 import rpc
 from neutron.tests import base
-from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin
 
 HOST = 'my_l2_host'
 L2_AGENT = {
similarity index 98%
rename from neutron/tests/unit/ml2/drivers/test_mech_mlnx.py
rename to neutron/tests/unit/plugins/ml2/drivers/test_mech_mlnx.py
index 6ccbe8658bbb671e562e3195a0d165039668408a..c055fa225ba2933689d2608de10df60ececcc409 100644 (file)
@@ -18,7 +18,7 @@ import mock
 from neutron.common import constants
 from neutron.extensions import portbindings
 from neutron.plugins.ml2 import driver_api as api
-from neutron.tests.unit.ml2 import _test_mech_agent as base
+from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
 
 m_const_mock = mock.Mock()
 
diff --git a/neutron/tests/unit/plugins/ml2/extensions/__init__.py b/neutron/tests/unit/plugins/ml2/extensions/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 90%
rename from neutron/tests/unit/ml2/test_agent_scheduler.py
rename to neutron/tests/unit/plugins/ml2/test_agent_scheduler.py
index fbf94a1b19cc0ada6e79935908c8a073294403b2..a55645cd6bd11b2a088730ec3a41c115f2ae3845 100644 (file)
@@ -13,8 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from neutron.tests.unit.ml2 import test_ml2_plugin
-from neutron.tests.unit.openvswitch import test_agent_scheduler
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin
+from neutron.tests.unit.plugins.openvswitch import test_agent_scheduler
 
 
 class Ml2AgentSchedulerTestCase(
similarity index 89%
rename from neutron/tests/unit/ml2/test_ext_portsecurity.py
rename to neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py
index 28fa68dcbb9c3ccd555542da03ab3b09934a07cc..9b0d2eeadf5d44e972e094caeb124358266d7aef 100644 (file)
@@ -14,8 +14,8 @@
 #    under the License.
 
 from neutron.plugins.ml2 import config
-from neutron.tests.unit.ml2 import test_ml2_plugin
-from neutron.tests.unit import test_extension_portsecurity as test_psec
+from neutron.tests.unit.extensions import test_portsecurity as test_psec
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin
 
 
 class PSExtDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase,
similarity index 98%
rename from neutron/tests/unit/ml2/test_extension_driver_api.py
rename to neutron/tests/unit/plugins/ml2/test_extension_driver_api.py
index 689dd79a99d67c2766c04e1958091eec3e2cbcd1..5fc4221630770b380958855d7d74b90af36502a7 100644 (file)
@@ -16,8 +16,8 @@ import mock
 from neutron import context
 from neutron import manager
 from neutron.plugins.ml2 import config
-from neutron.tests.unit.ml2.drivers import ext_test
-from neutron.tests.unit.ml2 import test_ml2_plugin
+from neutron.tests.unit.plugins.ml2.drivers import ext_test
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin
 
 
 class ExtensionDriverTestCase(test_ml2_plugin.Ml2PluginV2TestCase):
similarity index 97%
rename from neutron/tests/unit/ml2/test_mech_linuxbridge.py
rename to neutron/tests/unit/plugins/ml2/test_mech_linuxbridge.py
index 6fc708b0acec61f51e0ce3aa446d502e6c790e24..ed728548b5b490d9ac04c6f1f70d53ad1d2685bb 100644 (file)
@@ -16,7 +16,7 @@
 from neutron.common import constants
 from neutron.extensions import portbindings
 from neutron.plugins.ml2.drivers import mech_linuxbridge
-from neutron.tests.unit.ml2 import _test_mech_agent as base
+from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
 
 
 class LinuxbridgeMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
similarity index 98%
rename from neutron/tests/unit/ml2/test_mech_openvswitch.py
rename to neutron/tests/unit/plugins/ml2/test_mech_openvswitch.py
index b7b3be8e6045d241360247e110efcaa63de7a130..51303ba5a9348c9a7767e55a39c563a06dc09e3e 100644 (file)
@@ -18,7 +18,7 @@ from oslo_config import cfg
 from neutron.common import constants
 from neutron.extensions import portbindings
 from neutron.plugins.ml2.drivers import mech_openvswitch
-from neutron.tests.unit.ml2 import _test_mech_agent as base
+from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base
 
 
 class OpenvswitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
similarity index 98%
rename from neutron/tests/unit/ml2/test_mechanism_odl.py
rename to neutron/tests/unit/plugins/ml2/test_mechanism_odl.py
index 958e7d13411c50b381be8ef03a095dea1e55b48d..89161ac200213c45a2bb4b757c5df5fbb0e4669e 100644 (file)
@@ -17,7 +17,7 @@ import sys
 
 import mock
 from neutron import context
-from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
+from neutron.tests.unit.plugins.ml2 import test_ml2_plugin as test_plugin
 
 
 with mock.patch.dict(sys.modules,
similarity index 99%
rename from neutron/tests/unit/ml2/test_ml2_plugin.py
rename to neutron/tests/unit/plugins/ml2/test_ml2_plugin.py
index 1b770c00ed22c4d84a23280c7afbdc4c07216e15..e9cd744064de93451143493120e153a45db200aa 100644 (file)
@@ -48,12 +48,13 @@ from neutron.plugins.ml2 import models
 from neutron.plugins.ml2 import plugin as ml2_plugin
 from neutron.tests import base
 from neutron.tests.unit import _test_extension_portbindings as test_bindings
-from neutron.tests.unit.ml2.drivers import mechanism_logger as mech_logger
-from neutron.tests.unit.ml2.drivers import mechanism_test as mech_test
-from neutron.tests.unit import test_db_plugin as test_plugin
-from neutron.tests.unit import test_extension_allowedaddresspairs as test_pair
-from neutron.tests.unit import test_extension_extradhcpopts as test_dhcpopts
-from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc
+from neutron.tests.unit.db import test_allowedaddresspairs_db as test_pair
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
+from neutron.tests.unit.extensions import test_extra_dhcp_opt as test_dhcpopts
+from neutron.tests.unit.plugins.ml2.drivers import mechanism_logger as \
+     mech_logger
+from neutron.tests.unit.plugins.ml2.drivers import mechanism_test as mech_test
 
 
 config.cfg.CONF.import_opt('network_vlan_ranges',
@@ -93,7 +94,7 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
 
     def setup_parent(self):
         """Perform parent setup with the common plugin configuration class."""
-        l3_plugin = ('neutron.tests.unit.test_l3_plugin.'
+        l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
                      'TestL3NatServicePlugin')
         service_plugins = {'l3_plugin_name': l3_plugin}
         # Ensure that the parent setup can be called without arguments
similarity index 99%
rename from neutron/tests/unit/ml2/test_port_binding.py
rename to neutron/tests/unit/plugins/ml2/test_port_binding.py
index 83dca2d2f6788f080bc53592208954788ca1e7ff..8939c4f2d63fbdc47d639266dd05234311c48dbf 100644 (file)
@@ -20,7 +20,7 @@ from neutron.extensions import portbindings
 from neutron import manager
 from neutron.plugins.ml2 import config as config
 from neutron.plugins.ml2 import models as ml2_models
-from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
 
 
 PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
similarity index 95%
rename from neutron/tests/unit/ml2/test_security_group.py
rename to neutron/tests/unit/plugins/ml2/test_security_group.py
index c7d5a22faa212134791579cf889730bfc6f31ec4..6b1c3d016954c1006723b1096310501c9acfd9fb 100644 (file)
@@ -22,9 +22,9 @@ from neutron.api.v2 import attributes
 from neutron.common import constants as const
 from neutron.extensions import securitygroup as ext_sg
 from neutron import manager
-from neutron.tests.unit import test_api_v2
-from neutron.tests.unit import test_extension_security_group as test_sg
-from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc
+from neutron.tests.unit.api.v2 import test_base
+from neutron.tests.unit.extensions import test_securitygroup as test_sg
 
 PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
 NOTIFIER = 'neutron.plugins.ml2.rpc.AgentNotifierApi'
@@ -150,8 +150,8 @@ class TestMl2SecurityGroups(Ml2SecurityGroupsTestCase,
             # return no ports to exit the method early since we are mocking
             # the query
             fmock.return_value.all.return_value = []
-            plugin.get_ports_from_devices([test_api_v2._uuid(),
-                                           test_api_v2._uuid()])
+            plugin.get_ports_from_devices([test_base._uuid(),
+                                           test_base._uuid()])
             # the or_ function should only have one argument
             or_mock.assert_called_once_with(mock.ANY)
 
similarity index 98%
rename from neutron/tests/unit/ml2/test_type_gre.py
rename to neutron/tests/unit/plugins/ml2/test_type_gre.py
index 933da29361d0972cf22d3851daf62ff4f6b4a3a9..fba76f92cec1ec1f0d15ea160b9bc2b77eb22d3c 100644 (file)
@@ -23,8 +23,8 @@ from neutron.db import api as db_api
 from neutron.plugins.common import constants as p_const
 from neutron.plugins.ml2 import config
 from neutron.plugins.ml2.drivers import type_gre
-from neutron.tests.unit.ml2 import test_rpcapi
-from neutron.tests.unit.ml2 import test_type_tunnel
+from neutron.tests.unit.plugins.ml2 import test_rpcapi
+from neutron.tests.unit.plugins.ml2 import test_type_tunnel
 from neutron.tests.unit import testlib_api
 
 
similarity index 97%
rename from neutron/tests/unit/ml2/test_type_vxlan.py
rename to neutron/tests/unit/plugins/ml2/test_type_vxlan.py
index 3487c7f4534863799207cf8928ba9b9e149a99d6..b76b0094f25ba41cbb5e3958d5a7a90b29a78065 100644 (file)
@@ -18,8 +18,8 @@ import mock
 from neutron.plugins.common import constants as p_const
 from neutron.plugins.ml2 import config
 from neutron.plugins.ml2.drivers import type_vxlan
-from neutron.tests.unit.ml2 import test_rpcapi
-from neutron.tests.unit.ml2 import test_type_tunnel
+from neutron.tests.unit.plugins.ml2 import test_rpcapi
+from neutron.tests.unit.plugins.ml2 import test_type_tunnel
 from neutron.tests.unit import testlib_api
 
 
diff --git a/neutron/tests/unit/plugins/oneconvergence/__init__.py b/neutron/tests/unit/plugins/oneconvergence/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 94%
rename from neutron/tests/unit/oneconvergence/test_nvsd_plugin.py
rename to neutron/tests/unit/plugins/oneconvergence/test_nvsd_plugin.py
index c902cee6425d1aa12587deb4cc2d6891a88e8c39..f8ac5f48070a205e308a9a57fa68cb207513929d 100644 (file)
@@ -26,8 +26,8 @@ from neutron.extensions import portbindings
 from neutron import manager
 from neutron.plugins.oneconvergence import plugin as nvsd_plugin
 from neutron.tests.unit import _test_extension_portbindings as test_bindings
-from neutron.tests.unit import test_db_plugin as test_plugin
-from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
+from neutron.tests.unit.extensions import test_l3
 
 PLUGIN_NAME = 'neutron.plugins.oneconvergence.plugin.OneConvergencePluginV2'
 
@@ -98,7 +98,7 @@ class TestOneConvergenceV2HTTPResponse(test_plugin.TestV2HTTPResponse,
     pass
 
 
-class TestOneConvergenceL3NatTestCase(test_l3_plugin.L3NatDBIntTestCase):
+class TestOneConvergenceL3NatTestCase(test_l3.L3NatDBIntTestCase):
     _plugin_name = PLUGIN_NAME
 
     def setUp(self):
@@ -112,7 +112,7 @@ class TestOneConvergenceL3NatTestCase(test_l3_plugin.L3NatDBIntTestCase):
             self.nvsdlib = mock.Mock()
             self.nvsdlib.create_network.side_effect = side_effect
 
-        ext_mgr = test_l3_plugin.L3TestExtensionManager()
+        ext_mgr = test_l3.L3TestExtensionManager()
 
         with mock.patch.object(nvsd_plugin.OneConvergencePluginV2,
                                'oneconvergence_init',
similarity index 94%
rename from neutron/tests/unit/oneconvergence/test_security_group.py
rename to neutron/tests/unit/plugins/oneconvergence/test_security_group.py
index db245509ab9c0baeccdbbaceccb94f76ca2b052d..9820f9cfdf36c1598f55836071717d6962690b95 100644 (file)
@@ -20,14 +20,15 @@ from neutron.api.v2 import attributes
 from neutron.extensions import securitygroup as ext_sg
 from neutron import manager
 from neutron.plugins.oneconvergence import plugin as nvsd_plugin
-from neutron.tests.unit import test_extension_security_group as test_sg
-from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
+from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc
+from neutron.tests.unit.extensions import test_securitygroup as test_sg
 
 PLUGIN_NAME = ('neutron.plugins.oneconvergence.'
                'plugin.OneConvergencePluginV2')
 AGENTNOTIFIER = ('neutron.plugins.oneconvergence.'
                  'plugin.NVSDPluginV2AgentNotifierApi')
-DUMMY_NVSD_LIB = ('neutron.tests.unit.oneconvergence.dummynvsdlib.NVSDApi')
+DUMMY_NVSD_LIB = ('neutron.tests.unit.plugins.oneconvergence.'
+                  'dummynvsdlib.NVSDApi')
 
 
 class OneConvergenceSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
diff --git a/neutron/tests/unit/plugins/opencontrail/__init__.py b/neutron/tests/unit/plugins/opencontrail/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 97%
rename from neutron/tests/unit/opencontrail/test_contrail_plugin.py
rename to neutron/tests/unit/plugins/opencontrail/test_contrail_plugin.py
index 926b040de6667d413be6ef7ad6b1076a59e4efde..c79bd701ff56738fc696a18ac2b718b26c1c5c95 100644 (file)
@@ -36,10 +36,10 @@ from neutron.db import securitygroups_db
 from neutron.extensions import portbindings
 from neutron.extensions import securitygroup as ext_sg
 from neutron.tests.unit import _test_extension_portbindings as test_bindings
-from neutron.tests.unit import test_db_plugin as test_plugin
-from neutron.tests.unit import test_extension_security_group as test_sg
-from neutron.tests.unit import test_extensions
-from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.api import test_extensions
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
+from neutron.tests.unit.extensions import test_l3
+from neutron.tests.unit.extensions import test_securitygroup as test_sg
 
 
 CONTRAIL_PKG_PATH = "neutron.plugins.opencontrail.contrail_plugin"
@@ -310,7 +310,7 @@ class TestContrailPortBinding(ContrailPluginTestCase,
 
 
 class TestContrailL3NatTestCase(ContrailPluginTestCase,
-                                test_l3_plugin.L3NatDBIntTestCase):
+                                test_l3.L3NatDBIntTestCase):
     mock_rescheduling = False
 
     def setUp(self):
diff --git a/neutron/tests/unit/plugins/openvswitch/__init__.py b/neutron/tests/unit/plugins/openvswitch/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 98%
rename from neutron/tests/unit/openvswitch/test_agent_scheduler.py
rename to neutron/tests/unit/plugins/openvswitch/test_agent_scheduler.py
index 727fbbff1d19b61cb7c12d8691aa0afc10a6cd03..10eb7b20973be2cb0c1dd70c306b180a1eb30ced 100644 (file)
@@ -41,10 +41,10 @@ from neutron import manager
 from neutron.openstack.common import uuidutils
 from neutron.plugins.common import constants as service_constants
 from neutron.tests import fake_notifier
-from neutron.tests.unit import test_agent_ext_plugin
-from neutron.tests.unit import test_db_plugin as test_plugin
-from neutron.tests.unit import test_extensions
-from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.api import test_extensions
+from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
+from neutron.tests.unit.extensions import test_agent
+from neutron.tests.unit.extensions import test_l3
 from neutron.tests.unit import testlib_api
 from neutron import wsgi
 
@@ -200,13 +200,13 @@ class AgentSchedulerTestMixIn(object):
                 return agent_data['id']
 
 
-class OvsAgentSchedulerTestCaseBase(test_l3_plugin.L3NatTestCaseMixin,
-                                    test_agent_ext_plugin.AgentDBTestMixIn,
+class OvsAgentSchedulerTestCaseBase(test_l3.L3NatTestCaseMixin,
+                                    test_agent.AgentDBTestMixIn,
                                     AgentSchedulerTestMixIn,
                                     test_plugin.NeutronDbPluginV2TestCase):
     fmt = 'json'
     plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin'
-    l3_plugin = ('neutron.tests.unit.test_l3_plugin.'
+    l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
                  'TestL3NatAgentSchedulingServicePlugin')
 
     def setUp(self):
@@ -1265,8 +1265,8 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
                                                  exc.HTTPNotFound.code)
 
 
-class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
-                                   test_agent_ext_plugin.AgentDBTestMixIn,
+class OvsDhcpAgentNotifierTestCase(test_l3.L3NatTestCaseMixin,
+                                   test_agent.AgentDBTestMixIn,
                                    AgentSchedulerTestMixIn,
                                    test_plugin.NeutronDbPluginV2TestCase):
     plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin'
@@ -1424,12 +1424,12 @@ class OvsDhcpAgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
         self.assertTrue(self._is_schedule_network_called(device_id))
 
 
-class OvsL3AgentNotifierTestCase(test_l3_plugin.L3NatTestCaseMixin,
-                                 test_agent_ext_plugin.AgentDBTestMixIn,
+class OvsL3AgentNotifierTestCase(test_l3.L3NatTestCaseMixin,
+                                 test_agent.AgentDBTestMixIn,
                                  AgentSchedulerTestMixIn,
                                  test_plugin.NeutronDbPluginV2TestCase):
     plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin'
-    l3_plugin = ('neutron.tests.unit.test_l3_plugin.'
+    l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
                  'TestL3NatAgentSchedulingServicePlugin')
 
     def setUp(self):
diff --git a/neutron/tests/unit/plugins/sriovnicagent/__init__.py b/neutron/tests/unit/plugins/sriovnicagent/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/neutron/tests/unit/scheduler/__init__.py b/neutron/tests/unit/scheduler/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 99%
rename from neutron/tests/unit/test_l3_schedulers.py
rename to neutron/tests/unit/scheduler/test_l3_agent_scheduler.py
index b9877b31fdb3925171591440b3e7544161f3e632..267eceefa328ccb292cc7aa5e81b349b3863e053 100644 (file)
@@ -41,8 +41,8 @@ from neutron.extensions import l3agentscheduler as l3agent
 from neutron import manager
 from neutron.scheduler import l3_agent_scheduler
 from neutron.tests import base
-from neutron.tests.unit import test_db_plugin
-from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.db import test_db_base_plugin_v2
+from neutron.tests.unit.extensions import test_l3
 from neutron.tests.unit import testlib_api
 
 # the below code is required for the following reason
@@ -723,15 +723,15 @@ class L3SchedulerTestBaseMixin(object):
 class L3SchedulerTestCase(l3_agentschedulers_db.L3AgentSchedulerDbMixin,
                           l3_db.L3_NAT_db_mixin,
                           common_db_mixin.CommonDbMixin,
-                          test_db_plugin.NeutronDbPluginV2TestCase,
-                          test_l3_plugin.L3NatTestCaseMixin,
+                          test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
+                          test_l3.L3NatTestCaseMixin,
                           L3SchedulerBaseMixin,
                           L3SchedulerTestBaseMixin):
 
     def setUp(self):
         self.mock_rescheduling = False
-        ext_mgr = test_l3_plugin.L3TestExtensionManager()
-        plugin_str = ('neutron.tests.unit.test_l3_plugin.'
+        ext_mgr = test_l3.L3TestExtensionManager()
+        plugin_str = ('neutron.tests.unit.extensions.test_l3.'
                       'TestL3NatIntAgentSchedulingPlugin')
         super(L3SchedulerTestCase, self).setUp(plugin=plugin_str,
                                                ext_mgr=ext_mgr)
similarity index 98%
rename from neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py
rename to neutron/tests/unit/services/l3_router/test_l3_apic.py
index 12b8c808a391ec1f3900d5f9bc38bf666b0051f5..536c10e7a767cf2811d62ad678c7df7dc4f8bbb2 100644 (file)
@@ -21,7 +21,7 @@ sys.modules["apicapi"] = mock.Mock()
 
 from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic as md
 from neutron.services.l3_router import l3_apic
-from neutron.tests.unit.ml2.drivers.cisco.apic import (
+from neutron.tests.unit.plugins.ml2.drivers.cisco.apic import (
     test_cisco_apic_common as mocked)
 from neutron.tests.unit import testlib_api
 
diff --git a/neutron/tests/unit/services/metering/agents/__init__.py b/neutron/tests/unit/services/metering/agents/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
similarity index 99%
rename from neutron/tests/unit/services/metering/drivers/test_iptables_driver.py
rename to neutron/tests/unit/services/metering/drivers/test_iptables.py
index c1474f4517414e93d62e54d5fa6361026e3e4f09..5818a9775d35db1b66ede310ad04f41fefb93907 100644 (file)
@@ -19,9 +19,9 @@ from oslo_config import cfg
 
 from neutron.services.metering.drivers.iptables import iptables_driver
 from neutron.tests import base
-from neutron.tests.unit import test_api_v2
+from neutron.tests.unit.api.v2 import test_base
 
-_uuid = test_api_v2._uuid
+_uuid = test_base._uuid
 
 
 TEST_ROUTERS = [
index 90d0198527575359b0092452c13e97899c90791e..bd086b2230d3cd9e74512d28843ba1b5c23970dc 100644 (file)
@@ -27,9 +27,9 @@ from neutron.extensions import metering as ext_metering
 from neutron import manager
 from neutron.openstack.common import uuidutils
 from neutron.plugins.common import constants
-from neutron.tests.unit.db.metering import test_db_metering
-from neutron.tests.unit import test_db_plugin
-from neutron.tests.unit import test_l3_plugin
+from neutron.tests.unit.db.metering import test_metering_db
+from neutron.tests.unit.db import test_db_base_plugin_v2
+from neutron.tests.unit.extensions import test_l3
 
 
 _uuid = uuidutils.generate_uuid
@@ -58,9 +58,9 @@ class MeteringTestExtensionManager(object):
         return []
 
 
-class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase,
-                         test_l3_plugin.L3NatTestCaseMixin,
-                         test_db_metering.MeteringPluginDbTestCaseMixin):
+class TestMeteringPlugin(test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
+                         test_l3.L3NatTestCaseMixin,
+                         test_metering_db.MeteringPluginDbTestCaseMixin):
 
     resource_prefix_map = dict(
         (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING])
@@ -68,7 +68,7 @@ class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase,
     )
 
     def setUp(self):
-        plugin = 'neutron.tests.unit.test_l3_plugin.TestL3NatIntPlugin'
+        plugin = 'neutron.tests.unit.extensions.test_l3.TestL3NatIntPlugin'
         service_plugins = {'metering_plugin_name':
                            METERING_SERVICE_PLUGIN_KLASS}
         ext_mgr = MeteringTestExtensionManager()
@@ -277,9 +277,9 @@ class TestMeteringPlugin(test_db_plugin.NeutronDbPluginV2TestCase,
 
 class TestMeteringPluginL3AgentScheduler(
         l3_agentschedulers_db.L3AgentSchedulerDbMixin,
-        test_db_plugin.NeutronDbPluginV2TestCase,
-        test_l3_plugin.L3NatTestCaseMixin,
-        test_db_metering.MeteringPluginDbTestCaseMixin):
+        test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
+        test_l3.L3NatTestCaseMixin,
+        test_metering_db.MeteringPluginDbTestCaseMixin):
 
     resource_prefix_map = dict(
         (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING])
@@ -288,7 +288,7 @@ class TestMeteringPluginL3AgentScheduler(
 
     def setUp(self, plugin_str=None, service_plugins=None, scheduler=None):
         if not plugin_str:
-            plugin_str = ('neutron.tests.unit.test_l3_plugin.'
+            plugin_str = ('neutron.tests.unit.extensions.test_l3.'
                           'TestL3NatIntAgentSchedulingPlugin')
 
         if not service_plugins:
@@ -384,13 +384,13 @@ class TestMeteringPluginL3AgentSchedulerServicePlugin(
     """
 
     def setUp(self):
-        l3_plugin = ('neutron.tests.unit.test_l3_plugin.'
+        l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
                      'TestL3NatAgentSchedulingServicePlugin')
         service_plugins = {'metering_plugin_name':
                            METERING_SERVICE_PLUGIN_KLASS,
                            'l3_plugin_name': l3_plugin}
 
-        plugin_str = ('neutron.tests.unit.test_l3_plugin.'
+        plugin_str = ('neutron.tests.unit.extensions.test_l3.'
                       'TestNoL3NatPlugin')
 
         super(TestMeteringPluginL3AgentSchedulerServicePlugin, self).setUp(
@@ -399,9 +399,9 @@ class TestMeteringPluginL3AgentSchedulerServicePlugin(
 
 
 class TestMeteringPluginRpcFromL3Agent(
-        test_db_plugin.NeutronDbPluginV2TestCase,
-        test_l3_plugin.L3NatTestCaseMixin,
-        test_db_metering.MeteringPluginDbTestCaseMixin):
+        test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
+        test_l3.L3NatTestCaseMixin,
+        test_metering_db.MeteringPluginDbTestCaseMixin):
 
     resource_prefix_map = dict(
         (k.replace('_', '-'), constants.COMMON_PREFIXES[constants.METERING])
@@ -412,7 +412,7 @@ class TestMeteringPluginRpcFromL3Agent(
         service_plugins = {'metering_plugin_name':
                            METERING_SERVICE_PLUGIN_KLASS}
 
-        plugin = ('neutron.tests.unit.test_l3_plugin.'
+        plugin = ('neutron.tests.unit.extensions.test_l3.'
                   'TestL3NatIntAgentSchedulingPlugin')
 
         ext_mgr = MeteringTestExtensionManager()
similarity index 96%
rename from neutron/tests/unit/test_neutron_manager.py
rename to neutron/tests/unit/test_manager.py
index fc2744d4f2e500a79a9d12546562c64b383d2ab6..a29a9d63b46a69fcf0f3db2cf94cd91c1c852e8a 100644 (file)
@@ -96,14 +96,14 @@ class NeutronManagerTestCase(base.BaseTestCase):
                               ["neutron.tests.unit.dummy_plugin."
                                "DummyServicePlugin"])
         cfg.CONF.set_override("core_plugin",
-                              "neutron.tests.unit.test_neutron_manager."
+                              "neutron.tests.unit.test_manager."
                               "MultiServiceCorePlugin")
         e = self.assertRaises(ValueError, manager.NeutronManager.get_instance)
         self.assertIn(constants.DUMMY, e.message)
 
     def test_core_plugin_supports_services(self):
         cfg.CONF.set_override("core_plugin",
-                              "neutron.tests.unit.test_neutron_manager."
+                              "neutron.tests.unit.test_manager."
                               "MultiServiceCorePlugin")
         mgr = manager.NeutronManager.get_instance()
         svc_plugins = mgr.get_service_plugins()
@@ -134,7 +134,7 @@ class NeutronManagerTestCase(base.BaseTestCase):
                               ["neutron.tests.unit.dummy_plugin."
                                "DummyServicePlugin"])
         cfg.CONF.set_override("core_plugin",
-                              "neutron.tests.unit.test_neutron_manager."
+                              "neutron.tests.unit.test_manager."
                               "CorePluginWithAgentNotifiers")
         expected = {'l3': 'l3_agent_notifier',
                     'dhcp': 'dhcp_agent_notifier',
diff --git a/neutron/tests/unit/tests/__init__.py b/neutron/tests/unit/tests/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index 3d6be872bcadcc3384fcb9e9d4eca472df9d0895..e689f10e2d059dbea6a88c2cb5382e139b691b9d 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -172,8 +172,8 @@ neutron.ml2.type_drivers =
 neutron.ml2.mechanism_drivers =
     ovsvapp = neutron.plugins.ml2.drivers.ovsvapp.mech_driver:OVSvAppAgentMechanismDriver
     opendaylight = neutron.plugins.ml2.drivers.opendaylight.driver:OpenDaylightMechanismDriver
-    logger = neutron.tests.unit.ml2.drivers.mechanism_logger:LoggerMechanismDriver
-    test = neutron.tests.unit.ml2.drivers.mechanism_test:TestMechanismDriver
+    logger = neutron.tests.unit.plugins.ml2.drivers.mechanism_logger:LoggerMechanismDriver
+    test = neutron.tests.unit.plugins.ml2.drivers.mechanism_test:TestMechanismDriver
     linuxbridge = neutron.plugins.ml2.drivers.mech_linuxbridge:LinuxbridgeMechanismDriver
     openvswitch = neutron.plugins.ml2.drivers.mech_openvswitch:OpenvswitchMechanismDriver
     hyperv = neutron.plugins.ml2.drivers.hyperv.mech_hyperv:HypervMechanismDriver
@@ -195,11 +195,11 @@ neutron.ml2.mechanism_drivers =
     fslsdn = neutron.plugins.ml2.drivers.freescale.mechanism_fslsdn:FslsdnMechanismDriver
     sriovnicswitch = neutron.plugins.ml2.drivers.mech_sriov.mech_driver:SriovNicSwitchMechanismDriver
     nuage = neutron.plugins.ml2.drivers.mech_nuage.driver:NuageMechanismDriver
-    fake_agent = neutron.tests.unit.ml2.drivers.mech_fake_agent:FakeAgentMechanismDriver
+    fake_agent = neutron.tests.unit.plugins.ml2.drivers.mech_fake_agent:FakeAgentMechanismDriver
     sdnve = neutron.plugins.ml2.drivers.ibm.mechanism_sdnve:SdnveMechanismDriver
 neutron.ml2.extension_drivers =
-    test = neutron.tests.unit.ml2.drivers.ext_test:TestExtensionDriver
-    testdb = neutron.tests.unit.ml2.drivers.ext_test:TestDBExtensionDriver
+    test = neutron.tests.unit.plugins.ml2.drivers.ext_test:TestExtensionDriver
+    testdb = neutron.tests.unit.plugins.ml2.drivers.ext_test:TestDBExtensionDriver
     port_security = neutron.plugins.ml2.extensions.port_security:PortSecurityExtensionDriver
     cisco_n1kv_ext = neutron.plugins.ml2.drivers.cisco.n1kv.n1kv_ext_driver:CiscoN1kvExtensionDriver
 neutron.openstack.common.cache.backends =
diff --git a/tools/check_unit_test_structure.sh b/tools/check_unit_test_structure.sh
new file mode 100755 (executable)
index 0000000..9c250fe
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# This script identifies the unit test modules that do not correspond
+# directly with a module in the code tree.  See TESTING.rst for the
+# intended structure.
+
+neutron_path=$(cd "$(dirname "$0")/.." && pwd)
+base_test_path=neutron/tests/unit
+test_path=$neutron_path/$base_test_path
+
+test_files=$(find ${test_path} -iname 'test_*.py')
+
+ignore_regexes=(
+    "^plugins.*$"
+)
+
+error_count=0
+ignore_count=0
+total_count=0
+for test_file in ${test_files[@]}; do
+    relative_path=${test_file#$test_path/}
+    expected_path=$(dirname $neutron_path/neutron/$relative_path)
+    test_filename=$(basename "$test_file")
+    expected_filename=${test_filename#test_}
+    # Module filename (e.g. foo/bar.py -> foo/test_bar.py)
+    filename=$expected_path/$expected_filename
+    # Package dir (e.g. foo/ -> test_foo.py)
+    package_dir=${filename%.py}
+    if [ ! -f "$filename" ] && [ ! -d "$package_dir" ]; then
+        for ignore_regex in ${ignore_regexes[@]}; do
+            if [[ "$relative_path" =~ $ignore_regex ]]; then
+                ((ignore_count++))
+                continue 2
+            fi
+        done
+        echo "Unexpected test file: $base_test_path/$relative_path"
+        ((error_count++))
+    fi
+    ((total_count++))
+done
+
+if [ "$ignore_count" -ne 0 ]; then
+    echo "$ignore_count unmatched test modules were ignored"
+fi
+
+if [ "$error_count" -eq 0 ]; then
+    echo 'Success!  All test modules match targets in the code tree.'
+    exit 0
+else
+    echo "Failure! $error_count of $total_count test modules do not match targets in the code tree."
+    exit 1
+fi
index eeac227ed982229ed08b842e57e0bfe2dbc3101b..0b18f86e222d93562936fe572a63450518dcdd92 100644 (file)
@@ -32,7 +32,7 @@ check_opinionated_shell () {
     # If you cannot avoid the use of bash, please change the EXPECTED var below.
     OBSERVED=$(grep -E '^([[:space:]]*[^#[:space:]]|#!).*bash' \
                tox.ini tools/* | wc -l)
-    EXPECTED=7
+    EXPECTED=8
     if [ ${EXPECTED} -ne ${OBSERVED} ]; then
         echo "Bash usage has been detected!" >>$FAILURES
     fi
diff --git a/tox.ini b/tox.ini
index a32fa8c3429caddfacb7c586696b099afcb1f6cf..c3bb17f0e4ec1ff3753579f2dfe1c940ff405e57 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -77,6 +77,7 @@ deps =
 commands=
   # If it is easier to add a check via a shell script, consider adding it in this file
   sh ./tools/misc-sanity-checks.sh
+  {toxinidir}/tools/check_unit_test_structure.sh
   # Checks for coding and style guidelines
   flake8
   sh ./tools/coding-checks.sh --pylint '{posargs}'