Merge "Use unittest.mock instead of mock"

This commit is contained in:
Zuul 2020-06-24 16:42:11 +00:00 committed by Gerrit Code Review
commit fd73573024
4 changed files with 13 additions and 2 deletions

View File

@ -26,6 +26,8 @@ Below you can find a list of checks specific to this repository.
- [N343] Production code must not import from neutron.tests.* - [N343] Production code must not import from neutron.tests.*
- [N344] Python 3: Do not use filter(lambda obj: test(obj), data). Replace it - [N344] Python 3: Do not use filter(lambda obj: test(obj), data). Replace it
with [obj for obj in data if test(obj)]. with [obj for obj in data if test(obj)].
- [N346] Use neutron_lib.db.api.sqla_listen rather than sqlalchemy
- [N347] Test code must not import mock library
.. note:: .. note::
When adding a new hacking check to this repository or ``neutron-lib``, make When adding a new hacking check to this repository or ``neutron-lib``, make

View File

@ -44,7 +44,6 @@ logilab-common==1.4.1
logutils==0.3.5 logutils==0.3.5
Mako==0.4.0 Mako==0.4.0
MarkupSafe==1.0 MarkupSafe==1.0
mock==3.0.0
monotonic==0.6;python_version<'3.3' monotonic==0.6;python_version<'3.3'
mox3==0.20.0 mox3==0.20.0
msgpack-python==0.4.0 msgpack-python==0.4.0

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import fixtures import fixtures
import mock
from neutron_lib.api.definitions import extra_dhcp_opt as edo_ext from neutron_lib.api.definitions import extra_dhcp_opt as edo_ext
from neutron.common.ovn import constants from neutron.common.ovn import constants

View File

@ -172,8 +172,17 @@ import-order-style = pep8
[flake8:local-plugins] [flake8:local-plugins]
extension = extension =
# Checks specific to neutron repo # Checks specific to neutron repo
N322 = neutron.hacking.checks:check_assert_called_once_with
N328 = neutron.hacking.checks:check_asserttruefalse
N330 = neutron.hacking.checks:check_assertempty
N331 = neutron.hacking.checks:check_assertisinstance
N332 = neutron.hacking.checks:check_assertequal_for_httpcode
N340 = neutron.hacking.checks:check_oslo_i18n_wrapper N340 = neutron.hacking.checks:check_oslo_i18n_wrapper
N341 = neutron.hacking.checks:check_builtins_gettext N341 = neutron.hacking.checks:check_builtins_gettext
N343 = neutron.hacking.checks:check_no_imports_from_tests
N344 = neutron.hacking.checks:check_python3_no_filter
N346 = neutron.hacking.checks:check_no_sqlalchemy_event_import
N347 = neutron.hacking.checks:check_no_import_mock
# Checks from neutron-lib # Checks from neutron-lib
N521 = neutron_lib.hacking.checks:use_jsonutils N521 = neutron_lib.hacking.checks:use_jsonutils
N524 = neutron_lib.hacking.checks:check_no_contextlib_nested N524 = neutron_lib.hacking.checks:check_no_contextlib_nested