#5 Drop undesired test dependency on python3-mock
Merged 2 years ago by stevetraylen. Opened 2 years ago by churchyard.
rpms/ churchyard/python-humanize nomock  into  rawhide

file added
+39
@@ -0,0 +1,39 @@ 

+ From 9fe089a2ae88dabd17d74e24e2af42725f5b91c4 Mon Sep 17 00:00:00 2001

+ From: Kurt Mosiejczuk <kurt@cranky.work>

+ Date: Fri, 13 Sep 2019 18:51:33 -0400

+ Subject: [PATCH] Use built-in mock from unittest when available (Python 3.4+)

+ 

+ ---

+  setup.py      | 2 +-

+  tests/time.py | 5 ++++-

+  2 files changed, 5 insertions(+), 2 deletions(-)

+ 

+ diff --git a/setup.py b/setup.py

+ index 327388d..7638ec5 100644

+ --- a/setup.py

+ +++ b/setup.py

+ @@ -36,7 +36,7 @@

+      include_package_data=True,

+      zip_safe=False,

+      test_suite="tests",

+ -    tests_require=['mock'],

+ +    tests_require=['mock;python_version<"3.4"'],

+      install_requires=[

+        # -*- Extra requirements: -*-

+      ],

+ diff --git a/tests/time.py b/tests/time.py

+ index 7747c87..3068d0d 100644

+ --- a/tests/time.py

+ +++ b/tests/time.py

+ @@ -3,7 +3,10 @@

+  

+  """Tests for time humanizing."""

+  

+ -from mock import patch

+ +try:

+ +    from unittest.mock import patch

+ +except (ImportError, AttributeError):

+ +    from mock import patch

+  

+  from humanize import time

+  from datetime import date, datetime, timedelta

file modified
+9 -5
@@ -2,19 +2,20 @@ 

  

  Name:           python-humanize

  Version:        0.5.1

- Release:        28%{?dist}

+ Release:        29%{?dist}

  Summary:        Turns dates in to human readable format, e.g '3 minutes ago'

  

  License:        MIT

  URL:            https://github.com/jmoiron/humanize

  Source0:        %{url}/archive/%{version}.tar.gz

  

+ # Use built-in mock from unittest when available (Python 3.4+)

+ # Merged upstream, released in 1.0.0+

+ Patch:          %{url}/pull/78.patch

+ 

  BuildArch:      noarch

  BuildRequires:  python3-devel

  BuildRequires:  python3-setuptools

- %if %{with check}

- BuildRequires:  python3-mock

- %endif

  

  

  %global _description\
@@ -35,7 +36,7 @@ 

  readable size or throughput.

  

  %prep

- %setup -q -n humanize-%{version}

+ %autosetup -p1 -n humanize-%{version}

  

  # Remove shebangs from libs.

  for lib in humanize/time.py humanize/filesize.py humanize/number.py; do
@@ -70,6 +71,9 @@ 

  %exclude %{python3_sitelib}/humanize/locale/*/LC_MESSAGES/*.po

  

  %changelog

+ * Wed Jan 26 2022 Miro Hrončok <mhroncok@redhat.com> - 0.5.1-29

+ - Drop undesired test dependency on python3-mock

+ 

  * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.1-28

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

  

no initial comment

Pull-Request has been merged by stevetraylen

2 years ago
Metadata