From 3a120e97f68bdfa580b7751758e68cf4c8cdd9d5cfe6f1980042069c1a6432bd Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 19 May 2021 10:20:06 +0000 Subject: [PATCH] Accepting request 894266 from home:pgajdos:python - actually run the testsuite, use %pytest macro - added patches fix use unittest.mock instead of mock + python-flake8-polyfill-use-unittest-mock.patch OBS-URL: https://build.opensuse.org/request/show/894266 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-polyfill?expand=0&rev=7 --- ...on-flake8-polyfill-use-unittest-mock.patch | 16 ++++++++++++ python-flake8-polyfill.changes | 8 ++++++ python-flake8-polyfill.spec | 25 +++++++++++-------- 3 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 python-flake8-polyfill-use-unittest-mock.patch diff --git a/python-flake8-polyfill-use-unittest-mock.patch b/python-flake8-polyfill-use-unittest-mock.patch new file mode 100644 index 0000000..99cf42f --- /dev/null +++ b/python-flake8-polyfill-use-unittest-mock.patch @@ -0,0 +1,16 @@ +Index: flake8-polyfill-1.0.2/tests/test_options.py +=================================================================== +--- flake8-polyfill-1.0.2.orig/tests/test_options.py 2017-12-30 14:45:28.000000000 +0100 ++++ flake8-polyfill-1.0.2/tests/test_options.py 2021-05-19 09:45:18.723426614 +0200 +@@ -2,7 +2,10 @@ + import optparse + import os + +-import mock ++try: ++ import unittest.mock as mock ++except ImportError: ++ import mock + import pytest + + from flake8_polyfill import options diff --git a/python-flake8-polyfill.changes b/python-flake8-polyfill.changes index 9a05cca..a749480 100644 --- a/python-flake8-polyfill.changes +++ b/python-flake8-polyfill.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed May 19 07:13:03 UTC 2021 - pgajdos@suse.com + +- actually run the testsuite, use %pytest macro +- added patches + fix use unittest.mock instead of mock + + python-flake8-polyfill-use-unittest-mock.patch + ------------------------------------------------------------------- Tue Dec 4 12:48:07 UTC 2018 - Matej Cepl diff --git a/python-flake8-polyfill.spec b/python-flake8-polyfill.spec index d8d1501..15cb45e 100644 --- a/python-flake8-polyfill.spec +++ b/python-flake8-polyfill.spec @@ -1,7 +1,7 @@ # # spec file for package python-flake8-polyfill # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,24 +17,28 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without test Name: python-flake8-polyfill Version: 1.0.2 Release: 0 Summary: Polyfill package for Flake8 plugins License: MIT Group: Development/Languages/Python -Url: https://gitlab.com/pycqa/flake8-polyfill +URL: https://gitlab.com/pycqa/flake8-polyfill Source: https://files.pythonhosted.org/packages/source/f/flake8-polyfill/flake8-polyfill-%{version}.tar.gz +# https://gitlab.com/pycqa/flake8-polyfill/-/merge_requests/8 +Patch0: python-flake8-polyfill-use-unittest-mock.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -%if %{with test} -BuildRequires: %{python_module flake8} -%endif Requires: python-flake8 BuildArch: noarch - +# SECTION test requirements +%if %{suse_version} <= 1500 +BuildRequires: python2-mock +%endif +BuildRequires: %{python_module flake8} +BuildRequires: %{python_module pytest} +# /SECTION %python_subpackages %description @@ -43,6 +47,7 @@ Flake8 plugins that intend to support Flake8 2.x and 3.x simultaneously. %prep %setup -q -n flake8-polyfill-%{version} +%patch0 -p1 %build %python_build @@ -51,13 +56,11 @@ Flake8 plugins that intend to support Flake8 2.x and 3.x simultaneously. %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with test} %check -%python_exec setup.py test -%endif +# tests/test_stdin.py: we do not have pep8 module in TW +%pytest -c /dev/null tests/test_options.py %files %{python_files} -%defattr(-,root,root,-) %doc AUTHORS.rst CHANGELOG.rst README.rst %license LICENSE %{python_sitelib}/*