Accepting request 321557 from home:mlin7442:branches:devel:languages:python

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
This commit is contained in:
Todd R 2015-08-13 11:21:58 +00:00 committed by Git OBS Bridge
parent 2c0299908f
commit 40e0936688
3 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,34 @@
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Aug 10 08:45:26 UTC 2015 - mlin@suse.com
- Add upstream patch flake8-fix-tests-using-new-mock.patch
* Fix tests using mock 1.1.x and above
-------------------------------------------------------------------
Thu Feb 26 20:32:07 UTC 2015 - tbechtold@suse.com

View File

@ -24,6 +24,8 @@ License: MIT
Group: Development/Languages/Python
Url: http://bitbucket.org/tarek/flake8
Source: http://pypi.python.org/packages/source/f/flake8/flake8-%{version}.tar.gz
# PATCH-FIX-UPSTREAM flake8-fix-tests-using-new-mock.patch -- mlin@suse.com
Patch1: flake8-fix-tests-using-new-mock.patch
BuildRequires: python-devel
BuildRequires: python-setuptools
# Test requirements:
@ -53,6 +55,7 @@ Flake8 runs all the tools by launching the single ``flake8`` script.
%prep
%setup -q -n flake8-%{version}
%patch1 -p1
%build
python setup.py build