From 1eea81171aeec6ebaf6721c5b441288d27aa93ec Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Wed, 26 Jul 2017 09:05:21 -0700 Subject: [PATCH] Add tests to show '# noqa' works with mock.patch check Add two test lines to show that using '# noqa' will work to disable the mock.patch check that requires using autospec. Change-Id: I4c5777867265c15469e2f34e8e9dea49fa7bff98 --- hacking/checks/mock_checks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hacking/checks/mock_checks.py b/hacking/checks/mock_checks.py index a7ebad6..caa6b82 100644 --- a/hacking/checks/mock_checks.py +++ b/hacking/checks/mock_checks.py @@ -31,7 +31,9 @@ class MockAutospecCheck(object): Okay: mock.patch('target_module_1', spec_set=['data']) H210: mock.patch('target_module_1') + Okay: mock.patch('target_module_1') # noqa H210: mock.patch('target_module_1', somearg=23) + Okay: mock.patch('target_module_1', somearg=23) # noqa Okay: mock.patch.object('target_module_2', 'attribute', autospec=True) Okay: mock.patch.object('target_module_2', 'attribute', autospec=False)