From 653a6f24f6750ab3038a0fec26e69970e6992c3d Mon Sep 17 00:00:00 2001 From: yan12125 Date: Wed, 16 Nov 2022 14:26:56 +0000 Subject: [PATCH] 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 git-svn-id: file:///srv/repos/svn-community/svn@1349110 9fca08f4-af9d-4005-b8df-a31f2cc04f65 --- python-sure/trunk/PKGBUILD | 21 ++++++++---- python-sure/trunk/use-unittest-mock.diff | 42 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 python-sure/trunk/use-unittest-mock.diff diff --git a/python-sure/trunk/PKGBUILD b/python-sure/trunk/PKGBUILD index 7735ccd14945..a360900c4e48 100644 --- a/python-sure/trunk/PKGBUILD +++ b/python-sure/trunk/PKGBUILD @@ -1,19 +1,23 @@ # Maintainer: Felix Yan +# Maintainer: Chih-Hsuan Yen 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 @@ prepare() { 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 @@ build() { check() { cd "$srcdir"/sure-$pkgver - python setup.py test + PYTHONPATH="$PWD" pytest } package() { diff --git a/python-sure/trunk/use-unittest-mock.diff b/python-sure/trunk/use-unittest-mock.diff new file mode 100644 index 000000000000..8b9d9c880109 --- /dev/null +++ b/python-sure/trunk/use-unittest-mock.diff @@ -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 . + from __future__ import unicode_literals + import re +-import mock ++from unittest import mock + from collections import OrderedDict + + from datetime import datetime, timedelta