Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
upgpkg: python-sure 2.0.0-5; polishing
Browse files Browse the repository at this point in the history
* 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] gabrielfalcao/sure#161
[3] https://archlinux.org/todo/stop-using-python-setuppy-test/
[4] gabrielfalcao/sure#175
[5] gabrielfalcao/sure#182

git-svn-id: file:///srv/repos/svn-community/svn@1349110 9fca08f4-af9d-4005-b8df-a31f2cc04f65
  • Loading branch information
yan12125 authored and svntogit committed Nov 16, 2022
1 parent 31cbf53 commit 2ab1feb
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
21 changes: 15 additions & 6 deletions trunk/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>

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

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() {
Expand All @@ -30,7 +39,7 @@ build() {

check() {
cd "$srcdir"/sure-$pkgver
python setup.py test
PYTHONPATH="$PWD" pytest
}

package() {
Expand Down
42 changes: 42 additions & 0 deletions trunk/use-unittest-mock.diff
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2ab1feb

Please sign in to comment.