Accepting request 633129 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/633129
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-freezegun?expand=0&rev=4
This commit is contained in:
Yuchen Lin 2018-09-10 10:29:47 +00:00 committed by Git OBS Bridge
commit e0323d8712
3 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Sep 4 16:32:05 UTC 2018 - Matěj Cepl <mcepl@suse.com>
- Add remove_dependency_on_mock.patch which removes dependency on
python-mock for Python 3, where it is not required.
-------------------------------------------------------------------
Sun Jul 15 20:55:20 UTC 2018 - mimi.vx@gmail.com

View File

@ -27,6 +27,8 @@ Group: Development/Languages/Python
URL: https://github.com/spulec/freezegun
Source: https://files.pythonhosted.org/packages/source/f/freezegun/freezegun-%{version}.tar.gz
Patch0: _u_p37_tests.patch
# https://github.com/spulec/freezegun/issues/259
Patch1: remove_dependency_on_mock.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module python-dateutil > 2.0}
BuildRequires: %{python_module setuptools}
@ -37,8 +39,8 @@ Requires: python-python-dateutil > 2.0
Requires: python-six
BuildArch: noarch
%if %{with tests}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module nose}
BuildRequires: python2-mock
%endif
%python_subpackages
@ -48,7 +50,7 @@ time by mocking the datetime module.
%prep
%setup -q -n freezegun-%{version}
%patch0 -p1
%autopatch -p1
%build
%python_build

View File

@ -0,0 +1,24 @@
--- a/tests/test_ticking.py
+++ b/tests/test_ticking.py
@@ -1,6 +1,9 @@
import datetime
import time
-import mock
+try:
+ import mock
+except ImportError:
+ import unittest.mock as mock
from freezegun import freeze_time
from tests import utils
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,4 +1,7 @@
-import mock
+try:
+ import mock
+except ImportError:
+ import unittest.mock as mock
from nose.plugins import skip
from freezegun import api