Accepting request 633520 from home:mcepl:work
- Add remove_mock_dependency.patch patch providing independence from the external mock package. OBS-URL: https://build.opensuse.org/request/show/633520 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8?expand=0&rev=38
This commit is contained in:
parent
734d1f2728
commit
67e32bea8d
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 5 14:55:07 UTC 2018 - Matěj Cepl <mcepl@suse.com>
|
||||
|
||||
- Add remove_mock_dependency.patch patch providing independence from the
|
||||
external mock package.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 8 21:40:39 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
|
@ -29,6 +29,7 @@ Source: https://files.pythonhosted.org/packages/source/f/flake8/flake8-%
|
||||
#PATCH-FIX-UPSTREAM fix_pycodestyle_240.patch
|
||||
Patch0: fix_pycodestyle_240.patch
|
||||
Patch1: python-flake8-3.5.0-pyflakes-2.0.0.patch
|
||||
Patch2: remove_mock_dependency.patch
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
@ -40,7 +41,6 @@ Requires(postun): update-alternatives
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module mccabe >= 0.2.1}
|
||||
BuildRequires: %{python_module mock >= 2.0.0}
|
||||
BuildRequires: %{python_module pycodestyle >= 2.4.0}
|
||||
BuildRequires: %{python_module pyflakes >= 2.0.0}
|
||||
BuildRequires: %{python_module pytest-runner}
|
||||
@ -48,6 +48,7 @@ BuildRequires: %{python_module pytest}
|
||||
%if %{with python2}
|
||||
BuildRequires: python2-configparser
|
||||
BuildRequires: python2-enum34
|
||||
BuildRequires: python2-mock
|
||||
%endif
|
||||
# /SECTION
|
||||
%ifpython2
|
||||
|
278
remove_mock_dependency.patch
Normal file
278
remove_mock_dependency.patch
Normal file
@ -0,0 +1,278 @@
|
||||
--- a/tests/integration/test_checker.py
|
||||
+++ b/tests/integration/test_checker.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Integration tests for the checker submodule."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import checker
|
||||
--- a/tests/unit/test_application.py
|
||||
+++ b/tests/unit/test_application.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for the Application class."""
|
||||
import optparse
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import exceptions
|
||||
--- a/tests/unit/test_base_formatter.py
|
||||
+++ b/tests/unit/test_base_formatter.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for the BaseFormatter object."""
|
||||
import optparse
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import style_guide
|
||||
--- a/tests/unit/test_checker_manager.py
|
||||
+++ b/tests/unit/test_checker_manager.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for the Manager object for FileCheckers."""
|
||||
import errno
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import checker
|
||||
--- a/tests/unit/test_config_file_finder.py
|
||||
+++ b/tests/unit/test_config_file_finder.py
|
||||
@@ -4,7 +4,10 @@ import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8.options import config
|
||||
--- a/tests/unit/test_debug.py
|
||||
+++ b/tests/unit/test_debug.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Tests for our debugging module."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
import setuptools
|
||||
|
||||
--- a/tests/unit/test_file_checker.py
|
||||
+++ b/tests/unit/test_file_checker.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Unit tests for the FileChecker class."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
|
||||
from flake8 import checker
|
||||
|
||||
--- a/tests/unit/test_file_processor.py
|
||||
+++ b/tests/unit/test_file_processor.py
|
||||
@@ -5,7 +5,10 @@ import tokenize
|
||||
|
||||
from flake8 import processor
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
|
||||
--- a/tests/unit/test_get_local_plugins.py
|
||||
+++ b/tests/unit/test_get_local_plugins.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Tests for get_local_plugins."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
|
||||
from flake8.options import config
|
||||
|
||||
--- a/tests/unit/test_git.py
|
||||
+++ b/tests/unit/test_git.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Tests around functionality in the git integration."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8.main import git
|
||||
--- a/tests/unit/test_legacy_api.py
|
||||
+++ b/tests/unit/test_legacy_api.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Tests for Flake8's legacy API."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8.api import legacy as api
|
||||
--- a/tests/unit/test_merged_config_parser.py
|
||||
+++ b/tests/unit/test_merged_config_parser.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Unit tests for flake8.options.config.MergedConfigParser."""
|
||||
import os
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8.options import config
|
||||
--- a/tests/unit/test_option.py
|
||||
+++ b/tests/unit/test_option.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Unit tests for flake8.options.manager.Option."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8.options import manager
|
||||
--- a/tests/unit/test_option_manager.py
|
||||
+++ b/tests/unit/test_option_manager.py
|
||||
@@ -2,7 +2,10 @@
|
||||
import optparse
|
||||
import os
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import utils
|
||||
--- a/tests/unit/test_plugin.py
|
||||
+++ b/tests/unit/test_plugin.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for flake8.plugins.manager.Plugin."""
|
||||
import optparse
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import exceptions
|
||||
--- a/tests/unit/test_plugin_manager.py
|
||||
+++ b/tests/unit/test_plugin_manager.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Tests for flake8.plugins.manager.PluginManager."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
|
||||
from flake8.plugins import manager
|
||||
|
||||
--- a/tests/unit/test_plugin_type_manager.py
|
||||
+++ b/tests/unit/test_plugin_type_manager.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for flake8.plugins.manager.PluginTypeManager."""
|
||||
import collections
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import exceptions
|
||||
--- a/tests/unit/test_style_guide.py
|
||||
+++ b/tests/unit/test_style_guide.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for the flake8.style_guide.StyleGuide class."""
|
||||
import optparse
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import style_guide
|
||||
--- a/tests/unit/test_utils.py
|
||||
+++ b/tests/unit/test_utils.py
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Tests for flake8's utils module."""
|
||||
import os
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import utils
|
||||
--- a/tests/unit/test_violation.py
|
||||
+++ b/tests/unit/test_violation.py
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Tests for the flake8.style_guide.Violation class."""
|
||||
-import mock
|
||||
+try:
|
||||
+ import unittest.mock as mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from flake8 import style_guide
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -11,8 +11,12 @@ sys.path.insert(0, os.path.join(os.path.
|
||||
|
||||
import flake8
|
||||
|
||||
+PY2 = sys.version_info[0] == 2
|
||||
|
||||
-tests_require = ['mock >= 2.0.0', 'pytest']
|
||||
+tests_require = ['pytest']
|
||||
+
|
||||
+if PY2:
|
||||
+ tests_require.append('mock >= 2.0.0')
|
||||
|
||||
# NOTE(sigmavirus24): When updating these requirements, update them in
|
||||
# setup.cfg as well.
|
Loading…
Reference in New Issue
Block a user