57 Commits

Author SHA1 Message Date
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
Zuul
5eed32948b Merge "Fix H904 hacking_delayed_string_interpolation" 2020-10-13 13:47:23 +00:00
Paras Babbar
bfc1a64ac6 Move the most common hacking rules from other projects
This patch will copy the most common hacking rules used in diff.
projects and add them to hacking itself.

Currently, added assert_true_instance, assert_equal_type
assert_raises_regexp, assert_true_or_false_with_in
assert_equal_in

Change-Id: I122d250cab90964c346e9d53046a97c25054bc00
2020-09-29 23:57:52 +00:00
Sean McGinnis
6002520ae3
Fix H904 hacking_delayed_string_interpolation
The regex for this check was wrong, resulting in misses. This fixes the
checks for string interpolation and adds unit tests to make sure we are
actually handling the cases we expect to be.

Change-Id: Id61094bb8ee8e93275c51c53caeb9ca27252b144
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-07-22 14:12:05 -05:00
Hervé Beraud
46c876fef2 drop mock from lower-constraints and requirements
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we don't need it
in lower-constraints and requirements.

These changes will help us to drop `mock` from openstack/requirements

Change-Id: I71a09f2eddd3a344225cb69f9679e99fdeb3e2db
2020-06-09 01:11:19 +02:00
Stephen Finucane
51eadb6698 General cleanups
- Reorganize tox.ini
- Modernize doc build process
- Stop pinning pbr version

Change-Id: I0ee25a393db90ea741ae9973e8b91269d4f92cc7
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-22 16:52:51 +00:00
Vu Cong Tuan
800e1be48e Switch to stestr
According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: I44170fcc60ad6e12d7badec354a96873e5cc91ea
2018-07-24 10:54:56 +07:00
Doug Hellmann
368757b9ac uncap eventlet
We will manage the eventlet version using constraints now. See the
thread starting at
http://lists.openstack.org/pipermail/openstack-dev/2018-April/129096.html
for more details.

Change-Id: I39977f2c40bbb04f8e1994fc7dbad7628fae58b0
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-11 11:52:23 -04:00
OpenStack Proposal Bot
ece27ea492 Updated from global requirements
Change-Id: Iff9775ebd70f7ed4cde47b71e8307828fe2de218
2018-03-15 06:43:12 +00:00
OpenStack Proposal Bot
3d67c8e56a Updated from global requirements
Change-Id: Id81573cceaa628e68ecfb2275150c19c338ae030
2018-01-27 17:26:29 +00:00
OpenStack Proposal Bot
59c9c41394 Updated from global requirements
Change-Id: I25d3d888a41f00311b7cde97f9bad1ea91b059ff
2017-09-20 16:11:55 +00:00
Akihiro Motoki
39271f9300 Switch from oslosphinx to openstackdocstheme
Change-Id: I4ab08cd976dda6b9deb5116a7ab9d3da91fe69da
2017-07-12 12:35:18 +00:00
OpenStack Proposal Bot
635d5d34e6 Updated from global requirements
Change-Id: Ic8e9c791a84f066119b432417763cc4f706951ea
2017-02-10 05:46:55 +00:00
Tony Breeds
c82a0b0a33 Remove discover from test-requirements
It's only needed for python < 2.7 which is not supported

Change-Id: Id1d43700e2e02e956d34fe37c104433cff88d8f4
2017-01-03 13:53:58 +11:00
OpenStack Proposal Bot
74ced1ac4f Updated from global requirements
Change-Id: I5159f2af29a9a0a836593c954c8c589ed99386e0
2016-12-05 18:38:58 +00:00
OpenStack Proposal Bot
206d40b894 Updated from global requirements
Change-Id: Idb8561199fdcd953172050e89df4c2eb4630cb6a
2016-09-28 16:51:05 +00:00
OpenStack Proposal Bot
2bbd00c53f Updated from global requirements
Change-Id: Icd47c13361fc7ed1759d6c97b07e53f30f40a686
2016-09-27 09:58:01 +00:00
OpenStack Proposal Bot
2e1da1b546 Updated from global requirements
Change-Id: Iffbc1d61b0c5facf9ef45a9079a6dce54a936029
2016-08-11 17:46:51 +00:00
OpenStack Proposal Bot
13d02ec52f Updated from global requirements
Change-Id: I1d24b5268475d17eb121fc4332f937aed2f4e1bb
2016-06-21 17:57:30 +00:00
OpenStack Proposal Bot
ab68df1354 Updated from global requirements
Change-Id: I84e8ad3c9e9413077c120fb37d78f5acbc3e5e2c
2016-05-30 00:31:55 +00:00
OpenStack Proposal Bot
e141092524 Updated from global requirements
Change-Id: Iae42843ab9fc281e19c55865fc5a092fca75d77b
2016-05-26 16:56:00 +00:00
OpenStack Proposal Bot
7284cb4dea Updated from global requirements
Change-Id: I71bd0e873a2ac70973a0e403d6ad52829520f51c
2016-05-16 16:34:46 +00:00
Ian Cordasco
7e75793a5b Add reno and release notes tracking
This adds a placeholder file (like every other project has by default),
the source for the sphinx-generated release notes project, and the
appropriate requirements and tox environments.

Change-Id: I999b4f7014216361ba559158b13d776531dc8591
2016-04-21 09:19:03 -05:00
OpenStack Proposal Bot
c3b03a9d50 Updated from global requirements
Change-Id: I41198b59b6d48b97badc1b7e87fd679152ec3bb3
2016-04-08 13:20:07 +00:00
OpenStack Proposal Bot
c11724e7fd Updated from global requirements
Change-Id: Ifea9955336655d4aa302af42e31f96fd5364bed2
2016-02-19 18:49:22 +00:00
OpenStack Proposal Bot
44718ab1f2 Updated from global requirements
Change-Id: I4ca6470a6bc051c2b44e2810c62d018c96bf5681
2016-01-24 20:47:23 +00:00
OpenStack Proposal Bot
1bfbe65189 Updated from global requirements
Change-Id: Ib961c445041811397ba9e0c25c293e90d6c7a5ea
2016-01-16 03:24:57 +00:00
OpenStack Proposal Bot
f56de8fddc Updated from global requirements
Change-Id: I6188cd9cc09daca33f15bca2f685cfdffbe58995
2015-11-19 15:43:35 +00:00
OpenStack Proposal Bot
d53a948613 Updated from global requirements
Change-Id: Ied94f58eb41fa8a0b35018cafbde879a8cbbf17e
2015-07-22 04:54:15 +00:00
OpenStack Proposal Bot
bedf520866 Updated from global requirements
Change-Id: Ied1acd09ef92c9aa84b241887350cb84c68572d9
2015-05-01 20:08:17 +00:00
OpenStack Proposal Bot
4e094689b4 Updated from global requirements
Change-Id: I2e176c24804357ee58bd400201e5b255014e1cc5
2015-04-23 15:27:50 +00:00
OpenStack Proposal Bot
e73da20c62 Updated from global requirements
Change-Id: Ia594feb2a6cd17f0f6a96a8b38809881268df508
2015-03-21 00:07:13 +00:00
OpenStack Proposal Bot
ff36b8e0b8 Updated from global requirements
Change-Id: I66b17e548668e5b18550e39a8e7d9c71c8217c94
2015-01-27 02:15:34 +00:00
Joe Gordon
6c851bdf2f Add eventlet to test-requirements
eventlet isn't actually used by hacking, but its a common global import
(nova/__init__.py imports it) in OpenStack, so to make the hacking venvs
work with local hacks in repos that require eventlet, we just add it
here.

Since this is a test-requirement it shouldn't have any impact on
packaging of hacking.

Change-Id: I81098fb4f4debc2654d60ed28a02d64c5bbcedea
Closes-Bug: 1403270
2014-12-16 17:34:21 -08:00
OpenStack Proposal Bot
f0369f6b0d Updated from global requirements
Change-Id: Ie53464be90338bcc2b4d9a360ffd076fdf174426
2014-11-20 14:04:09 +00:00
OpenStack Proposal Bot
e1db46af79 Updated from global requirements
Change-Id: I3cc06e37008930bacf14067d7e722db0f5b3fafd
2014-11-18 11:29:30 +00:00
OpenStack Proposal Bot
1ab303149c Updated from global requirements
Change-Id: Ie4800f92968c861712eb90fdc0b9155d2502b244
2014-11-16 14:59:48 +00:00
OpenStack Proposal Bot
6653550b5b Updated from global requirements
Change-Id: I7431b746fc0ac8992d9cec94b61b66654bfb8081
2014-11-05 08:28:32 +00:00
OpenStack Proposal Bot
41057a54e8 Updated from global requirements
Change-Id: I0ff2b0d1f5099d5ab18fdf363f1a024e8a0dde84
2014-10-11 15:49:15 +00:00
OpenStack Proposal Bot
a96112d98f Updated from global requirements
Change-Id: I982863a35c5056ea652f043e1856786acb5504c5
2014-09-23 01:54:32 +00:00
Jenkins
2cb6531448 Merge "Fix import check interaction with namespace modules" 2014-09-21 01:53:19 +00:00
OpenStack Proposal Bot
e0254ebd84 Updated from global requirements
Change-Id: I67c2cc189e1acd5b9acdcc6d111ee73f7b631feb
2014-09-18 13:58:07 +00:00
OpenStack Proposal Bot
483d7ad0c8 Updated from global requirements
Change-Id: I9c5097a7cbb816eae7aac837fb2bbe6ddf72c56f
2014-09-11 00:24:03 +00:00
OpenStack Proposal Bot
f979f7cd6a Updated from global requirements
Change-Id: If2fac7db6c929e9695aee81794eb15ab7053711d
2014-08-22 12:27:01 +00:00
Ben Nemec
22f37a1d39 Fix import check interaction with namespace modules
When running hacking from an oslo.* lib, all other oslo.* libs get
categorized as project because the import check was only looking at
the base module.  So when running in oslo.db, oslo.db should be
categorized as project and oslo.config as third-party, but both were
being seen as project because _get_import_type was only looking at
the 'oslo' part of the import.

This change extends _get_import_type to look at the entire module
path and adds the necessary logic for handling namespace modules
and non-module imports.  Since this is fairly complex and can't be
tested with doctests, standalone test cases are also added to verify
the behavior of the new code.

Note that prior to this change, oslo.db had 5 apparent H305
violations and 3 H307, which was incorrect.  After this change,
hacking correctly reports 3 H305 violations and 1 H307.

Also, because some of the stdlib modules don't play nice with the
new lookup method, this also includes a static list of stdlib
modules that will also be used for py2/3 compatibility in a
followup commit.

Change-Id: Ibb8c982bafcd69c9d642e86aa357a3a11b4395af
2014-07-10 21:24:18 +00:00
OpenStack Proposal Bot
4e8c087816 Updated from global requirements
Change-Id: I60f43640490e647d1e13686e67f4d53941eab67e
2014-06-13 22:50:43 +00:00
OpenStack Proposal Bot
bdda7e6cb6 Updated from global requirements
Change-Id: Ic0123983cef9545d1fcc036550ec64d0e844a91b
2014-05-26 23:48:00 +00:00
OpenStack Jenkins
4136882dc4 Updated from global requirements
Change-Id: Ie5d5c4ff3516a4097c23ea0dabb6d3a9bbf502fe
2014-02-23 09:23:21 +00:00
Dirk Mueller
f487cff435 Switch over to oslosphinx
oslosphinx is the new name of oslo.sphinx

Change-Id: I70ac51fcd7148832f94b7aae5049893bc650846d
Closes-Bug: #1277168
2014-02-14 18:52:42 +01:00
OpenStack Jenkins
1ae42e83d9 Updated from global requirements
Change-Id: If1de34be01f00db55b239fb34cc04b04190d8d8d
2014-02-06 03:54:27 +00:00