diff --git a/venus/hacking/checks.py b/venus/hacking/checks.py index 344c60c..c3cf900 100644 --- a/venus/hacking/checks.py +++ b/venus/hacking/checks.py @@ -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``") diff --git a/venus/tests/test_hacking.py b/venus/tests/test_hacking.py index c101929..0a4dc21 100644 --- a/venus/tests/test_hacking.py +++ b/venus/tests/test_hacking.py @@ -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)'