hacking/test-requirements.txt
Sean McGinnis b921c4de51 Add H216 to flag use of third party mock
Many projects use mocking in their unit tests, and most do not realize
that there is a difference between "import mock" and "import
unittest.mock", assuming that both use a standard part of the Python
library.

We've seen many cases where mock is not listed in the project's
requirements, but the code imports the third party mock instead of
unittest.mock. We've also seen a few break due to this, once their
dependencies have stopped pulling in that package for them.

There have also been several projects that have taken the effort to
switch all of there "import mock" statements over to "import
unittest.mock", as well as removing mock from their requirements, only
to then accidentally merge a patch that does "import mock" again because
it is hard to notice in code reviews.

This check is on by default. If a project is using the mock lib, then
they are able to explicitly do so by disabling this check. Otherwise,
projects don't need to take any action to get this protection, since
this is now the recommended default.

Change-Id: I8d255a00792a19279074703a8209a3699b480fd0
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-12-01 14:23:27 -06:00

18 lines
759 B
Plaintext

# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
python-subunit>=1.0.0 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
ddt>=1.2.1 # MIT
# hacking doesn't use this anywhere, but nova imports this in nova/__init__.py
# since eventlet is such a common universal import, add it to the hacking test
# virtualenv, so importing things like 'nova.hacking.checks.factory' will just
# work.
# See https://bugs.launchpad.net/hacking/+bug/1403270
eventlet!=0.18.3,!=0.20.1,>=0.18.2 # MIT