Accepting request 800051 from home:polslinux:branches:devel:languages:python

- Use pytest instead of nose
- Add use_pytest.patch

OBS-URL: https://build.opensuse.org/request/show/800051
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-purl?expand=0&rev=6
This commit is contained in:
Tomáš Chvátal 2020-05-04 13:02:02 +00:00 committed by Git OBS Bridge
parent fbc383900c
commit e013160ed7
3 changed files with 76 additions and 3 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon May 4 12:41:10 UTC 2020 - Paolo Stivanin <info@paolostivanin.com>
- Use pytest instead of nose
- Add use_pytest.patch
-------------------------------------------------------------------
Sun Jun 9 15:12:31 UTC 2019 - Jan Engelhardt <jengelh@inai.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-purl
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -25,7 +25,9 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/codeinthehole/purl
Source: https://github.com/codeinthehole/purl/archive/%{version}.tar.gz
BuildRequires: %{python_module nose}
# https://github.com/codeinthehole/purl/pull/42
Patch0: use_pytest.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes
@ -39,6 +41,7 @@ An immutable URL class for URL building and manipulation.
%prep
%setup -q -n purl-%{version}
%patch0 -p1
%build
%python_build
@ -48,7 +51,7 @@ An immutable URL class for URL building and manipulation.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} nosetests-%{$python_bin_suffix} -v
%pytest tests/utils_tests.py tests/expansion_tests.py tests/template_tests.py tests/url_tests.py
%files %{python_files}
%doc README.rst

64
use_pytest.patch Normal file
View File

@ -0,0 +1,64 @@
diff -ru a/makefile b/makefile
--- a/makefile 2019-03-10 21:51:02.000000000 +0100
+++ b/makefile 2020-05-04 14:33:39.928123174 +0200
@@ -3,7 +3,7 @@
python setup.py develop
test:
- nosetests
+ pytest tests/
package: clean
# Test these packages in a fresh virtualenvs:
Only in b: .pytest_cache
diff -ru a/requirements.txt b/requirements.txt
--- a/requirements.txt 2019-03-10 21:51:02.000000000 +0100
+++ b/requirements.txt 2020-05-04 14:33:54.216151730 +0200
@@ -4,5 +4,5 @@
wheel==0.33.1
# Testing
-nose==1.3.7
+pytest
tox==3.7.0
diff -ru a/runtests.sh b/runtests.sh
--- a/runtests.sh 2019-03-10 21:51:02.000000000 +0100
+++ b/runtests.sh 2020-05-04 14:34:09.352181984 +0200
@@ -1,5 +1,3 @@
#!/usr/bin/env bash
-# The doctests only work in Python2.* due to unicode issues that I
-# don't know how to solve.
-nosetests --with-doctest --doctest-extension=rst -s $@
+pytest tests/
diff -ru a/tests/expansion_tests.py b/tests/expansion_tests.py
--- a/tests/expansion_tests.py 2019-03-10 21:51:02.000000000 +0100
+++ b/tests/expansion_tests.py 2020-05-04 14:29:32.167627853 +0200
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
import collections
-from nose.tools import eq_
-
from purl.template import expand
# Define variables as in the RFC (http://tools.ietf.org/html/rfc6570)
@@ -117,7 +115,7 @@
def assert_expansion(template, fields, expected):
- eq_(expand(template, fields), expected)
+ assert expand(template, fields) == expected
def test_expansion():
diff -ru a/tox.ini b/tox.ini
--- a/tox.ini 2019-03-10 21:51:02.000000000 +0100
+++ b/tox.ini 2020-05-04 14:30:03.975691441 +0200
@@ -7,5 +7,5 @@
envlist = py26, py27, py34, pypy
[testenv]
-commands = nosetests []
+commands = pytest
deps = -r{toxinidir}/requirements.txt