hacking: force explicit import of python's mock
Change-Id: I1eccee0ea400487937f59557c69141a66043678b
This commit is contained in:
parent
8164828f7b
commit
d477ae1d7b
@ -204,4 +204,5 @@ def import_stock_mock(logical_line):
|
||||
N366
|
||||
"""
|
||||
if logical_line == 'import mock':
|
||||
yield 0, msg.get(366)
|
||||
yield (0, "N366: You must explicitly import python's mock: "
|
||||
"``from unittest import mock``")
|
||||
|
@ -153,8 +153,11 @@ class HackingTestCase(unittest.TestCase):
|
||||
def test_import_stock_mock(self):
|
||||
self.assertEqual(1, len(list(checks.import_stock_mock(
|
||||
'import mock'))))
|
||||
self.assertEqual(0, len(list(checks.import_stock_mock(
|
||||
'from unittest import mock'))))
|
||||
code = """
|
||||
from unittest import mock
|
||||
import unittest.mock
|
||||
"""
|
||||
self.assertEqual(0, len(list(checks.import_stock_mock(code))))
|
||||
|
||||
def test_no_xrange(self):
|
||||
line = 'xrange(10)'
|
||||
|
Loading…
Reference in New Issue
Block a user