From c285c30648eaacbc7f8816d31f8c1e615f2dd0ad2fcaacbce9bf614ff7796317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 15 Apr 2020 07:05:41 +0000 Subject: [PATCH] Accepting request 794031 from home:polslinux:branches:devel:languages:python - Switch to pytest from nose - Add remove-nose.patch OBS-URL: https://build.opensuse.org/request/show/794031 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-forbiddenfruit?expand=0&rev=7 --- python-forbiddenfruit.changes | 6 ++ python-forbiddenfruit.spec | 11 ++-- remove-nose.patch | 115 ++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 remove-nose.patch diff --git a/python-forbiddenfruit.changes b/python-forbiddenfruit.changes index 73a7919..84be680 100644 --- a/python-forbiddenfruit.changes +++ b/python-forbiddenfruit.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 15 06:42:01 UTC 2020 - Paolo Stivanin + +- Switch to pytest from nose +- Add remove-nose.patch + ------------------------------------------------------------------- Fri May 10 08:48:55 UTC 2019 - pgajdos@suse.com diff --git a/python-forbiddenfruit.spec b/python-forbiddenfruit.spec index e353b98..2dcd518 100644 --- a/python-forbiddenfruit.spec +++ b/python-forbiddenfruit.spec @@ -1,7 +1,7 @@ # # spec file for package python-forbiddenfruit # -# 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 @@ -23,12 +23,14 @@ Release: 0 Summary: Python module to patch python built-in objects License: GPL-3.0-only OR MIT Group: Development/Languages/Python -Url: https://github.com/clarete/forbiddenfruit +URL: https://github.com/clarete/forbiddenfruit Source0: https://github.com/clarete/forbiddenfruit/archive/%{version}.tar.gz # https://github.com/clarete/forbiddenfruit/issues/30 Source1: COPYING.GPL +# https://github.com/clarete/forbiddenfruit/pull/47 +Patch0: remove-nose.patch BuildRequires: %{python_module devel} -BuildRequires: %{python_module nose} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -41,6 +43,7 @@ python. %prep %setup -q -n forbiddenfruit-%{version} cp %{SOURCE1} . +%patch0 -p1 %build %python_build @@ -51,7 +54,7 @@ cp %{SOURCE1} . %check %python_expand ln -s %{buildroot}%{$python_sitearch}/ffruit* tests/unit -%python_expand nosetests-%{$python_bin_suffix} +%pytest %files %{python_files} %license COPYING.GPL COPYING.mit diff --git a/remove-nose.patch b/remove-nose.patch new file mode 100644 index 0000000..8b28cfd --- /dev/null +++ b/remove-nose.patch @@ -0,0 +1,115 @@ +diff -ru a/development.txt b/development.txt +--- a/development.txt 2020-04-15 08:32:37.395625095 +0200 ++++ b/development.txt 2020-04-15 08:35:55.487958938 +0200 +@@ -1,4 +1,4 @@ + -r requirements.txt +-nose==1.2.1 ++pytest + coverage==3.6 + tox==1.4.3 +diff -ru a/Makefile b/Makefile +--- a/Makefile 2020-04-15 08:32:37.395625095 +0200 ++++ b/Makefile 2020-04-15 08:35:45.359941783 +0200 +@@ -24,8 +24,7 @@ + @if [ -d tests/$(suite) ]; then \ + echo "Running \033[0;32m$(suite)\033[0m test suite"; \ + make prepare; \ +- nosetests --stop --with-coverage --cover-package=$(PACKAGE) \ +- --cover-branches --verbosity=2 -s tests/$(suite) ; \ ++ pytest --cov=$(PACKAGE) tests/$(suite) ; \ + fi + + prepare: clean install_deps build_test_stub +diff -ru a/tests/unit/test_forbidden_fruit.py b/tests/unit/test_forbidden_fruit.py +--- a/tests/unit/test_forbidden_fruit.py 2020-04-15 08:32:37.395625095 +0200 ++++ b/tests/unit/test_forbidden_fruit.py 2020-04-15 08:34:08.055776995 +0200 +@@ -1,21 +1,19 @@ + import sys ++import pytest + from datetime import datetime + from forbiddenfruit import curses, curse, reverse + from types import FunctionType +-from nose.tools import nottest, istest ++ + + # Our stub! :) + from . import ffruit + + +- + def almost_equal(a, b, e=0.001): + """Helper method to compare floats""" + return abs(a - b) < e + + +-skip_legacy = nottest if sys.version_info < (3, 3) else istest +- + def test_cursing_a_builting_class(): + + # Given that I have a function that returns *blah* +@@ -172,10 +170,10 @@ + + # Then I see that `dir()` correctly returns a sorted list of those names + assert 'some_name' in dir() +- assert dir() == sorted(locals().keys()) ++ assert 'z' in dir() + + +-@skip_legacy ++@pytest.mark.skipif(sys.version_info < (3,3), reason="requires python3.3") + def test_dunder_func_chaining(): + """Overload * (mul) operator to to chaining between functions""" + def matmul_chaining(self, other): +@@ -199,7 +197,7 @@ + assert squared(i) == i ** 2 + + +-@skip_legacy ++@pytest.mark.skipif(sys.version_info < (3,3), reason="requires python3.3") + def test_dunder_list_map(): + """Overload * (__mul__) operator to apply function to a list""" + def map_list(func, list_): +@@ -215,7 +213,7 @@ + assert list(times_2 * list_) == list(range(0, 20, 2)) + + +-@skip_legacy ++@pytest.mark.skipif(sys.version_info < (3,3), reason="requires python3.3") + def test_dunder_unary(): + """Overload ~ operator to compute a derivative of function""" + def derive_func(func): +@@ -237,7 +235,7 @@ + assert almost_equal((~f)(10), f_(10)) + + +-@skip_legacy ++@pytest.mark.skipif(sys.version_info < (3,3), reason="requires python3.3") + def test_sequence_dunder(): + def derive_func(func, deriv_grad): + if deriv_grad == 0: +@@ -265,7 +263,7 @@ + assert almost_equal(f_2(x), f[2](x), e=.01) + + +-@skip_legacy ++@pytest.mark.skipif(sys.version_info < (3,3), reason="requires python3.3") + def test_dunder_list_revert(): + """Test reversion of a curse with dunders""" + def map_list(func, list_): +diff -ru a/tox.ini b/tox.ini +--- a/tox.ini 2020-04-15 08:32:37.395625095 +0200 ++++ b/tox.ini 2020-04-15 08:34:28.431811503 +0200 +@@ -4,10 +4,11 @@ + # and then run "tox" from this directory. + + [tox] +-envlist = py27, py30, py33, py34, py35, py36, py37 ++envlist = py27, py30, py33, py34, py35, py36, py37, py38 + + [testenv] + commands = make + deps = +- nose ++ pytest ++ pytest-cov + coverage