forked from pool/python-flake8
Accepting request 672184 from home:alarrosa:branches:devel:languages:python
- Add missing dependency on python3-typing when python3 < 3.5 - Add fix-mock-patch-with-python3.4.patch to fix building the package in Leap 42.3. In python 3.5, mock.patch uses create=True automatically if you are patching builtins in a module, but in python 3.4 the argument is still needed. - Enable tests - Add allow-bytes-filenames.patch to fix some tests that fail because they pass bytes objects as filenames. - Update remove_mock_dependency.patch to fix another test that used mock OBS-URL: https://build.opensuse.org/request/show/672184 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8?expand=0&rev=45
This commit is contained in:
committed by
Git OBS Bridge
parent
a15f4220a7
commit
4ca7b43c11
58
fix-mock-patch-with-python3.4.patch
Normal file
58
fix-mock-patch-with-python3.4.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From: Antonio Larrosa <alarrosa@suse.com>
|
||||
Subject: Fix mock.patch with python3.4
|
||||
|
||||
In python 3.5, mock.patch uses create=True automatically if you are patching
|
||||
builtins in a module, but in python 3.4 the argument is still needed.
|
||||
Index: flake8-3.7.5/tests/unit/test_debug.py
|
||||
===================================================================
|
||||
--- flake8-3.7.5.orig/tests/unit/test_debug.py
|
||||
+++ flake8-3.7.5/tests/unit/test_debug.py
|
||||
@@ -70,7 +70,7 @@ def test_information(system, pyversion,
|
||||
system.assert_called_once_with()
|
||||
|
||||
|
||||
-@mock.patch('flake8.main.debug.print')
|
||||
+@mock.patch('flake8.main.debug.print', create=True)
|
||||
@mock.patch('flake8.main.debug.information', return_value={})
|
||||
@mock.patch('json.dumps', return_value='{}')
|
||||
def test_print_information_no_plugins(dumps, information, print_mock):
|
||||
@@ -85,7 +85,7 @@ def test_print_information_no_plugins(du
|
||||
assert print_mock.called is False
|
||||
|
||||
|
||||
-@mock.patch('flake8.main.debug.print')
|
||||
+@mock.patch('flake8.main.debug.print', create=True)
|
||||
@mock.patch('flake8.main.debug.information', return_value={})
|
||||
@mock.patch('json.dumps', return_value='{}')
|
||||
def test_print_information(dumps, information, print_mock):
|
||||
Index: flake8-3.7.5/tests/unit/test_base_formatter.py
|
||||
===================================================================
|
||||
--- flake8-3.7.5.orig/tests/unit/test_base_formatter.py
|
||||
+++ flake8-3.7.5/tests/unit/test_base_formatter.py
|
||||
@@ -23,7 +23,7 @@ def test_start(filename):
|
||||
"""Verify we open a new file in the start method."""
|
||||
mock_open = mock.mock_open()
|
||||
formatter = base.BaseFormatter(options(output_file=filename))
|
||||
- with mock.patch('flake8.formatting.base.open', mock_open):
|
||||
+ with mock.patch('flake8.formatting.base.open', mock_open, create=True):
|
||||
formatter.start()
|
||||
|
||||
if filename is None:
|
||||
@@ -90,7 +90,7 @@ def test_write_uses_an_output_file(tee):
|
||||
formatter = base.BaseFormatter(options(tee=tee))
|
||||
formatter.output_fd = filemock
|
||||
|
||||
- with mock.patch('flake8.formatting.base.print') as print_func:
|
||||
+ with mock.patch('flake8.formatting.base.print', create=True) as print_func:
|
||||
formatter.write(line, source)
|
||||
if tee:
|
||||
assert print_func.called
|
||||
@@ -109,7 +109,7 @@ def test_write_uses_an_output_file(tee):
|
||||
]
|
||||
|
||||
|
||||
-@mock.patch('flake8.formatting.base.print')
|
||||
+@mock.patch('flake8.formatting.base.print', create=True)
|
||||
def test_write_uses_print(print_function):
|
||||
"""Verify that we use the print function without an output file."""
|
||||
line = 'Something to write'
|
||||
Reference in New Issue
Block a user