Date: Wednesday, November 16, 2022 @ 14:26:56
  Author: yan12125
Revision: 1349110

upgpkg: python-sure 2.0.0-5; polishing

* Move away from python-mock [1] with a patch based on upstream one [2]
* Move away from `python setup.py test` [3] as well as switching from
  nosetests to pytest, which is supported since 2.0.0 [4]. This allows
  dropping python-rednose from checkdepends but python-nose is still
  needed [5]
* Mention myself as a maintainer

[1] https://archlinux.org/todo/drop-python-mock-checkdepends/
[2] https://github.com/gabrielfalcao/sure/pull/161
[3] https://archlinux.org/todo/stop-using-python-setuppy-test/
[4] https://github.com/gabrielfalcao/sure/pull/175
[5] https://github.com/gabrielfalcao/sure/issues/182

Added:
  python-sure/trunk/use-unittest-mock.diff
Modified:
  python-sure/trunk/PKGBUILD

------------------------+
 PKGBUILD               |   21 +++++++++++++++------
 use-unittest-mock.diff |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 6 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2022-11-16 14:26:37 UTC (rev 1349109)
+++ PKGBUILD    2022-11-16 14:26:56 UTC (rev 1349110)
@@ -1,19 +1,23 @@
 # Maintainer: Felix Yan <[email protected]>
+# Maintainer: Chih-Hsuan Yen <[email protected]>
 
 pkgname=python-sure
 pkgver=2.0.0
-pkgrel=4
+pkgrel=5
 pkgdesc="An idiomatic testing library for python with powerful and flexible 
assertions"
 arch=('any')
 url="https://github.com/gabrielfalcao/sure";
 license=('GPL')
-depends=('python-six' 'python-mock')
+depends=('python-six')
 makedepends=('python-setuptools' 'git')
-checkdepends=('python-nose' 'python-rednose')
+# python-nose is still imported in some tests 
https://github.com/gabrielfalcao/sure/issues/182
+checkdepends=('python-pytest' 'python-nose')
 
source=("$pkgname-$pkgver.tar.gz::https://github.com/gabrielfalcao/sure/archive/$pkgver.tar.gz";
-        "python310.diff")
+        "python310.diff"
+        "use-unittest-mock.diff")
 
sha512sums=('d113b08afd63c379ec9f05169b1ad15f3bb616a1f6ad7d0ef6513e98ba7ebb7462254b2d25307906d9f63603fed4f9e4b83ccbca0ec53a2b483f9395fa0fb94a'
-            
'0703cc88d01928e25e94e92fc0cfee68c6759322c9ee1d1603f381b6d67d6cf9db97f26aad1ccf7f6d6702370bc2c0194245aa3ba1c1b1384027a5712e469139')
+            
'0703cc88d01928e25e94e92fc0cfee68c6759322c9ee1d1603f381b6d67d6cf9db97f26aad1ccf7f6d6702370bc2c0194245aa3ba1c1b1384027a5712e469139'
+            
'ad17f0bc171058cc488f844a55bd0cf2f83b391c6c47b4ac1864b5de0d0842eb086dd1413c249a05684a45c67542c15eadfa2a7cdff095669e327d0e80f09183')
 
 prepare() {
   export LC_CTYPE=en_US.UTF-8
@@ -21,6 +25,11 @@
   cd "$srcdir"/sure-$pkgver
   # https://github.com/gabrielfalcao/sure/issues/169
   patch -Np1 -i ../python310.diff
+
+  # Based on the first two commits in 
https://github.com/gabrielfalcao/sure/pull/161
+  patch -Np1 -i ../use-unittest-mock.diff
+
+  sed -i 's#--cov=sure##' setup.cfg
 }
 
 build() {
@@ -30,7 +39,7 @@
 
 check() {
   cd "$srcdir"/sure-$pkgver
-  python setup.py test
+  PYTHONPATH="$PWD" pytest
 }
 
 package() {

Added: use-unittest-mock.diff
===================================================================
--- use-unittest-mock.diff                              (rev 0)
+++ use-unittest-mock.diff      2022-11-16 14:26:56 UTC (rev 1349110)
@@ -0,0 +1,42 @@
+diff --git a/setup.py b/setup.py
+index 016a14b..b208b3d 100755
+--- a/setup.py
++++ b/setup.py
+@@ -81,7 +81,7 @@ def read_readme():
+         return __doc__
+ 
+ 
+-install_requires = ["mock", "six"]
++install_requires = ["six"]
+ tests_require = ["nose"]
+ version = read_version()
+ 
+diff --git a/sure/core.py b/sure/core.py
+index da59e7c..76e9c9e 100644
+--- a/sure/core.py
++++ b/sure/core.py
+@@ -21,7 +21,10 @@ import os
+ try:
+     from mock import _CallList
+ except ImportError:
+-    from mock.mock import _CallList
++    try:
++        from mock.mock import _CallList
++    except ImportError:
++        from unittest.mock import _CallList
+ 
+ import inspect
+ from six import (
+diff --git a/tests/test_assertion_builder.py b/tests/test_assertion_builder.py
+index 9ce637f..6e33aa8 100644
+--- a/tests/test_assertion_builder.py
++++ b/tests/test_assertion_builder.py
+@@ -17,7 +17,7 @@
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ from __future__ import unicode_literals
+ import re
+-import mock
++from unittest import mock
+ from collections import OrderedDict
+ 
+ from datetime import datetime, timedelta

Reply via email to