15
0
forked from pool/python-exam

Accepting request 961561 from devel:languages:python

- Add patch no-mock.patch:
  * Stop using mock.
- Drop mock BuildRequires/Requires.
- No longer run testsuite twice.

OBS-URL: https://build.opensuse.org/request/show/961561
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-exam?expand=0&rev=5
This commit is contained in:
2022-03-15 18:03:42 +00:00
committed by Git OBS Bridge
3 changed files with 84 additions and 12 deletions

70
no-mock.patch Normal file
View File

@@ -0,0 +1,70 @@
Index: exam-0.10.6/exam/decorators.py
===================================================================
--- exam-0.10.6.orig/exam/decorators.py
+++ exam-0.10.6/exam/decorators.py
@@ -1,6 +1,6 @@
from __future__ import absolute_import
-from mock import patch
+from unittest.mock import patch
from functools import partial, wraps
import types
Index: exam-0.10.6/exam/helpers.py
===================================================================
--- exam-0.10.6.orig/exam/helpers.py
+++ exam-0.10.6/exam/helpers.py
@@ -4,7 +4,7 @@ import shutil
import os
import functools
-from mock import MagicMock, patch, call
+from unittest.mock import MagicMock, patch, call
def rm_f(path):
Index: exam-0.10.6/exam/mock.py
===================================================================
--- exam-0.10.6.orig/exam/mock.py
+++ exam-0.10.6/exam/mock.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
-from mock import Mock as BaseMock
-from mock import call
+from unittest.mock import Mock as BaseMock
+from unittest.mock import call
class Mock(BaseMock):
Index: exam-0.10.6/tests/test_cases.py
===================================================================
--- exam-0.10.6.orig/tests/test_cases.py
+++ exam-0.10.6/tests/test_cases.py
@@ -1,4 +1,4 @@
-from mock import sentinel
+from unittest.mock import sentinel
from tests import TestCase
from exam.decorators import before, after, around, patcher
Index: exam-0.10.6/tests/test_helpers.py
===================================================================
--- exam-0.10.6.orig/tests/test_helpers.py
+++ exam-0.10.6/tests/test_helpers.py
@@ -1,5 +1,5 @@
from tests import TestCase
-from mock import patch, Mock, sentinel
+from unittest.mock import patch, Mock, sentinel
from exam.helpers import intercept, rm_f, track, mock_import, call, effect
from exam.decorators import fixture
Index: exam-0.10.6/tests/test_objects.py
===================================================================
--- exam-0.10.6.orig/tests/test_objects.py
+++ exam-0.10.6/tests/test_objects.py
@@ -1,4 +1,4 @@
-from mock import sentinel
+from unittest.mock import sentinel
from tests import TestCase
from exam.objects import always, noop

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Mar 14 05:55:32 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch no-mock.patch:
* Stop using mock.
- Drop mock BuildRequires/Requires.
- No longer run testsuite twice.
-------------------------------------------------------------------
Fri Aug 14 13:06:42 UTC 2020 - John Vandenberg <jayvdb@gmail.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-exam
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -22,20 +22,16 @@ Version: 0.10.6
Release: 0
Summary: Helpers for better testing
License: MIT
Group: Development/Languages/Python
URL: https://github.com/fluxx/exam
Source: https://files.pythonhosted.org/packages/source/e/exam/exam-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/Fluxx/exam/master/LICENSE
# https://github.com/Fluxx/exam/pull/50
Patch0: remove_nose.patch
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
BuildRequires: %{python_module mock}
Patch1: no-mock.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
%ifpython2
Requires: python-mock
%endif
BuildRequires: python-rpm-macros
Recommends: python-pep8
Recommends: python-pyflakes
BuildArch: noarch
@@ -43,14 +39,13 @@ BuildArch: noarch
%python_subpackages
%description
Exam is a Python toolkit for writing better tests.
Exam is a Python toolkit for writing better tests.
It aims to remove a lot of the boiler plate testing
code one often writes, while still following Python
conventions and adhering to the unit testing interface.
%prep
%setup -q -n exam-%{version}
%patch0 -p1
%autosetup -p1 -n exam-%{version}
cp %{SOURCE1} .
%build
@@ -61,7 +56,6 @@ cp %{SOURCE1} .
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_exec -m unittest discover -s tests/ -v
%pytest
%files %{python_files}