python-flake8/fix-mock-patch-with-python3.4.patch
Dirk Mueller 9b70505bd2 Accepting request 930687 from home:marxin:branches:devel:languages:python
- update to 4.0.1:
  * Update spec python module dependencies accordingly.
  * Fix parallel execution collecting a SyntaxError (See also #1410 #1408).
- update to 4.0.0:
  * Remove --install-hook vcs integration (See also #1008).
  * Remove setuptools command (See also #1009).
  * Migrate from GitLab to GitHub (See also #1305).
  * Due to constant confusion by users, user-level |Flake8| configuration files
    are no longer supported. Files will not be searched for in the user's home
    directory (e.g., ~/.flake8) nor in the XDG config directory (e.g.,
    ~/.config/flake8).  (See also #1404).
  * pycodestyle has been updated to >= 2.8.0, < 2.9.0 (See also #1406).
  * Pyflakes has been updated to >= 2.4.0, < 2.5.0 (See also #1406).
  * flake8 requires python >= 3.6 (See also #1010).
  * Add --extend-select option (See also #1312 #1061).
  * Automatically create directories for output files (See also #1329).
  * ast parse before tokenizing to improve SyntaxError errors (See also
    #1320 #740).
  * Fix warning in --indent-size argparse help (See also #1367).
  * Fix handling SyntaxError in python 3.10+ (See also #1374
    #1372).
  * Fix writing non-cp1252-encodable when output is piped on windows (See also
    #1382 #1381).
- Rebase fix-mock-patch-with-python3.4.patch and remove ignore-selectable-groups-warning.patch.

OBS-URL: https://build.opensuse.org/request/show/930687
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8?expand=0&rev=76
2021-11-10 14:27:52 +00:00

41 lines
1.7 KiB
Diff

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.
diff --git a/tests/unit/test_base_formatter.py b/tests/unit/test_base_formatter.py
index d096457..47e74a6 100644
--- a/tests/unit/test_base_formatter.py
+++ b/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:
diff --git a/tests/unit/test_debug.py b/tests/unit/test_debug.py
index 2da4bf8..074b409 100644
--- a/tests/unit/test_debug.py
+++ b/tests/unit/test_debug.py
@@ -95,7 +95,7 @@ def test_information(system, pyversion, pyimpl):
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):
@@ -112,7 +112,7 @@ def test_print_information_no_plugins(dumps, information, print_mock):
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):