14
0

- Add remove-nose.patch:

* Use pytest, rather than nose.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requirements-parser?expand=0&rev=15
This commit is contained in:
2021-09-21 01:02:57 +00:00
committed by Git OBS Bridge
parent f360a0a79c
commit b0700a4b28
3 changed files with 55 additions and 4 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Sep 21 01:02:21 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Add remove-nose.patch:
* Use pytest, rather than nose.
-------------------------------------------------------------------
Wed Apr 15 08:39:06 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-requirements-parser
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -27,10 +27,11 @@ URL: https://github.com/davidfischer/requirements-parser
Source: https://github.com/davidfischer/requirements-parser/archive/v%{version}.tar.gz#/requirements-parser-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch alarrosa@suse.com -- https://github.com/davidfischer/requirements-parser/pull/47
Patch0: 0001-Dont-fail-with-valid-options-in-requirements_txt-files.patch
Patch1: remove-nose.patch
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module nose}
BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
BuildArch: noarch
@@ -42,7 +43,7 @@ A Pip requirement file parser.
%prep
%setup -q -n requirements-parser-%{version}
%patch0 -p1
%autopatch -p1
%build
%python_build
@@ -52,7 +53,7 @@ A Pip requirement file parser.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_exec -m nose
%pytest
%files %{python_files}
%doc AUTHORS.rst README.rst docs/*.rst

44
remove-nose.patch Normal file
View File

@@ -0,0 +1,44 @@
Index: requirements-parser-0.2.0/tests/test_parser.py
===================================================================
--- requirements-parser-0.2.0.orig/tests/test_parser.py
+++ requirements-parser-0.2.0/tests/test_parser.py
@@ -1,6 +1,6 @@
import os
import json
-from nose.tools import raises, assert_equal
+from pytest import raises
import warnings
from requirements import parse
@@ -32,17 +32,17 @@ def test_requirement_files():
return f
@fancy
- @raises(ValueError)
def check_fail(s):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- list([dict(r) for r in parse(s)])
+ with raises(ValueError):
+ list([dict(r) for r in parse(s)])
@fancy
def check(s, expected):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
- assert_equal(listify(dict(r) for r in parse(s)), expected)
+ assert listify(dict(r) for r in parse(s)) == expected
fp = os.path.join(REQFILE_DIR, fn)
@@ -51,8 +51,8 @@ def test_requirement_files():
continue
if 'fail' in fn:
- yield check_fail, open(fp)
+ check_fail(open(fp))
else:
with open(fp[:-4] + '.expected', 'r') as f2:
expected = json.loads(f2.read())
- yield check, open(fp), expected
+ check(open(fp), expected)