forked from pool/python-flake8
40e0936688
fix tests using mock 1.1.x OBS-URL: https://build.opensuse.org/request/show/321557 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8?expand=0&rev=20
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
From b0f30f97fbec04c1ab7cb8937f636822eab63885 Mon Sep 17 00:00:00 2001
|
|
From: Ian Cordasco <graffatcolmingov@gmail.com>
|
|
Date: Fri, 10 Jul 2015 09:34:49 -0500
|
|
Subject: [PATCH] Fix flake8 tests using mock to work with 1.1.x branch
|
|
|
|
--- a/flake8/tests/test_engine.py
|
|
+++ b/flake8/tests/test_engine.py
|
|
@@ -51,7 +51,7 @@ class TestEngine(unittest.TestCase):
|
|
self.assertTrue(len(registered_exts[0]) > 0)
|
|
for i in registered_exts[1:]:
|
|
self.assertTrue(isinstance(i, list))
|
|
- register_check.assert_called()
|
|
+ self.assertTrue(register_check.called)
|
|
|
|
def test_get_parser(self):
|
|
# setup
|
|
@@ -66,13 +66,13 @@ class TestEngine(unittest.TestCase):
|
|
# actual call we're testing
|
|
parser, hooks = engine.get_parser()
|
|
# assertions
|
|
- re.assert_called()
|
|
- gpv.assert_called()
|
|
+ self.assertTrue(re.called)
|
|
+ self.assertTrue(gpv.called)
|
|
pgp.assert_called_once_with(
|
|
'flake8',
|
|
'%s (pyflakes: 0.7, mccabe: 0.2) Python Version' % __version__)
|
|
- m.remove_option.assert_called()
|
|
- m.add_option.assert_called()
|
|
+ self.assertTrue(m.remove_option.called)
|
|
+ self.assertTrue(m.add_option.called)
|
|
self.assertEqual(parser, m)
|
|
self.assertEqual(hooks, [])
|
|
# clean-up
|