Update to 2.0.0

This commit is contained in:
Benjamin A. Beasley 2021-06-24 12:23:52 -04:00
parent 4bc2932881
commit 30f15544e1
5 changed files with 37 additions and 72 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@
/sure-1.4.0.tar.gz
/sure-1.4.10.tar.gz
/sure-1.4.11.tar.gz
/sure-2.0.0.tar.gz

View File

@ -1,64 +0,0 @@
From 9f0e834b2e5eea5dfe21d5be4ea6a3df47baf0b9 Mon Sep 17 00:00:00 2001
From: Timo Furrer <timo.furrer@roche.com>
Date: Wed, 20 Feb 2019 13:26:46 +0100
Subject: [PATCH] Import ABCs from collections.abc. Closes #150
---
.travis.yml | 10 +++++++---
sure/compat.py | 5 +++++
sure/old.py | 5 +----
tests/test_assertion_builder.py | 2 +-
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/sure/compat.py b/sure/compat.py
index df8d323..c53ab28 100644
--- a/sure/compat.py
+++ b/sure/compat.py
@@ -5,6 +5,11 @@
import six
from collections import OrderedDict
+try:
+ from collections.abc import Iterable
+except ImportError:
+ from collections import Iterable
+
from sure.terminal import red, green, yellow
diff --git a/sure/old.py b/sure/old.py
index e861b26..53e4ee4 100644
--- a/sure/old.py
+++ b/sure/old.py
@@ -22,10 +22,6 @@
from copy import deepcopy
from pprint import pformat
from functools import wraps
-try:
- from collections import Iterable
-except ImportError:
- Iterable = (list, dict, tuple, set)
try:
import __builtin__ as builtins
@@ -43,6 +39,7 @@
from sure.core import _get_file_name
from sure.core import _get_line_number
from sure.core import itemize_length
+from sure.compat import Iterable
def identify_callable_location(callable_object):
diff --git a/tests/test_assertion_builder.py b/tests/test_assertion_builder.py
index 4dc00fc..c043648 100644
--- a/tests/test_assertion_builder.py
+++ b/tests/test_assertion_builder.py
@@ -137,7 +137,7 @@ def test_should_be_a():
("this(None).should.be.none")
assert this(1).should.be.an(int)
- assert this([]).should.be.a('collections.Iterable')
+ assert this([]).should.be.a('sure.compat.Iterable')
assert this({}).should_not.be.a(list)
def opposite():

View File

@ -1,22 +1,21 @@
%global srcname sure
Name: python-%{srcname}
Version: 1.4.11
Release: 15%{?dist}
Version: 2.0.0
Release: 1%{?dist}
Summary: Idiomatic assertion toolkit with human-friendly failure messages
License: GPLv3+
URL: https://github.com/gabrielfalcao/%{srcname}
Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
# Python 3.9 compatibility
# https://github.com/gabrielfalcao/sure/commit/9f0e834b2e5eea5dfe21d5be4ea6a3df47baf0b9
Patch1: 9f0e834b2e5eea5dfe21d5be4ea6a3df47baf0b9.patch
# Trivial downstream man page for (nearly pointless) executable
Source1: %{srcname}.1
# Python 3.10 workaround
# In test_context_is_not_optional(), only check the exception type
# https://github.com/gabrielfalcao/sure/issues/169
Patch2: python3.10-workaround.patch
Patch0: python3.10-workaround.patch
BuildArch: noarch
@ -31,11 +30,18 @@ BuildRequires: pyproject-rpm-macros
# TODO: remove the test dependency on nose
# https://fedoraproject.org/wiki/Changes/DeprecateNose
BuildRequires: python3dist(nose)
# development.txt: pytest==6.2.4
BuildRequires: python3dist(pytest)
# development.txt: pytest-cov==2.12.1
# (We dont need coverage reports, but it is easier to add the dependency than
# to patch setup.cfg.)
BuildRequires: python3dist(pytest-cov)
# Documentation dependentcies
# Documentation dependencies
BuildRequires: make
# development.txt: Sphinx==2.3.1
BuildRequires: python3dist(sphinx)
# development.txt: sphinx-rtd-theme==0.4.3
BuildRequires: python3dist(sphinx-rtd-theme)
BuildRequires: python3-docs
@ -78,6 +84,8 @@ sed -r -i \
-e '/redis.*https.*readthedocs/d' \
docs/source/conf.py
cp -p '%{SOURCE1}' .
%build
%pyproject_wheel
@ -88,6 +96,8 @@ env PYTHONPATH="${PWD}" %make_build -C docs/ html SPHINXOPTS='%{?_smp_mflags}'
%pyproject_install
%pyproject_save_files %{srcname}
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 %{srcname}.1
%check
%pytest
@ -95,6 +105,8 @@ env PYTHONPATH="${PWD}" %make_build -C docs/ html SPHINXOPTS='%{?_smp_mflags}'
%files -n python3-%{srcname} -f %{pyproject_files}
%license COPYING
%{_bindir}/%{srcname}
%{_mandir}/man1/%{srcname}.1*
%files doc
@ -106,6 +118,11 @@ env PYTHONPATH="${PWD}" %make_build -C docs/ html SPHINXOPTS='%{?_smp_mflags}'
%changelog
* Thu Jun 24 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.0.0-1
- Update to 2.0.0 (closes RHBZ#1974521)
- Drop 9f0e834b2e5eea5dfe21d5be4ea6a3df47baf0b9.patch, now merged upstream
- Add downstream man page for new “sure” executable
* Thu Jun 24 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.4.11-15
- Add license file to new -doc subpackage

View File

@ -1 +1 @@
SHA512 (sure-1.4.11.tar.gz) = 0f3601eff81074d73568014aaf81b2a3e782c95d3a62cf689031bd0c53eaa8eb531a32e4e2d16c4bee4291157f621e52857b575bcfdaf82839f8e1d0d40d3563
SHA512 (sure-2.0.0.tar.gz) = d113b08afd63c379ec9f05169b1ad15f3bb616a1f6ad7d0ef6513e98ba7ebb7462254b2d25307906d9f63603fed4f9e4b83ccbca0ec53a2b483f9395fa0fb94a

11
sure.1 Normal file
View File

@ -0,0 +1,11 @@
.TH SURE "1" "June 2021" "" "User Commands"
.SH NAME
sure \- idiomatic assertion toolkit for Python
.SH SYNOPSIS
.B sure
.P
Prints version information and a basic example for the Python API.
.SH "SEE\ ALSO"
https://sure.readthedocs.io/
.P
.BR python (1)