From f42a7f63a7bd7c2bcb7ac4bb42e97279e15eb64620b07003ea8074674f1d8f21 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 13 Aug 2020 16:09:43 +0000 Subject: [PATCH] - Add remove_nose.patch to remove dependency on nose (gh#eventlet/eventlet#638). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-eventlet?expand=0&rev=70 --- python-eventlet.changes | 5 ++ python-eventlet.spec | 13 ++++- remove_nose.patch | 125 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 remove_nose.patch diff --git a/python-eventlet.changes b/python-eventlet.changes index b81dfe3..f500208 100644 --- a/python-eventlet.changes +++ b/python-eventlet.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 13 16:07:08 UTC 2020 - Matej Cepl + +- Add remove_nose.patch to remove dependency on nose (gh#eventlet/eventlet#638). + ------------------------------------------------------------------- Thu Aug 13 14:07:43 UTC 2020 - Dirk Mueller diff --git a/python-eventlet.spec b/python-eventlet.spec index b4a2bfa..9642762 100644 --- a/python-eventlet.spec +++ b/python-eventlet.spec @@ -25,10 +25,12 @@ License: MIT Group: Development/Languages/Python URL: http://eventlet.net Source: https://files.pythonhosted.org/packages/source/e/eventlet/eventlet-%{version}.tar.gz +# PATCH-FEATURE-UPSTREAM remove_nose.patch gh#eventlet/eventlet#638 mcepl@suse.com +# Removes dependency on nose +Patch0: remove_nose.patch BuildRequires: %{python_module dnspython >= 1.15.0} BuildRequires: %{python_module greenlet >= 0.3} BuildRequires: %{python_module monotonic >= 1.4} -BuildRequires: %{python_module nose} BuildRequires: %{python_module pyOpenSSL} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six >= 1.10.0} @@ -36,6 +38,9 @@ BuildRequires: fdupes BuildRequires: netcfg BuildRequires: python-rpm-macros # eventlet parses /etc/protocols which is not available in normal build envs +# Tests +BuildRequires: %{python_module pytest} +BuildRequires: sysconfig-netconfig Requires: netcfg Requires: python-greenlet >= 0.3 Requires: python-monotonic >= 1.4 @@ -56,6 +61,8 @@ interpreter, or as part of a larger application. %prep %setup -q -n eventlet-%{version} +%autopatch -p1 + sed -i "s|^#!.*||" eventlet/support/greendns.py # Fix non-executable script %build @@ -66,8 +73,8 @@ sed -i "s|^#!.*||" eventlet/support/greendns.py # Fix non-executable script %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# 400 out of 600 tests either fail or error out -#%%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} nosetests-%{$python_bin_suffix} -v +# All tests fail (gh#eventlet/eventlet#638) +%pytest || /bin/true %files %{python_files} %license LICENSE diff --git a/remove_nose.patch b/remove_nose.patch new file mode 100644 index 0000000..ad6abf1 --- /dev/null +++ b/remove_nose.patch @@ -0,0 +1,125 @@ +--- a/setup.py ++++ b/setup.py +@@ -28,7 +28,7 @@ setuptools.setup( + 'README.rst' + ) + ).read(), +- test_suite='nose.collector', ++ test_suite='tests', + classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", +--- a/eventlet.egg-info/SOURCES.txt ++++ b/eventlet.egg-info/SOURCES.txt +@@ -174,7 +174,6 @@ tests/greenthread_test.py + tests/hub_test.py + tests/mock.py + tests/mysqldb_test.py +-tests/nosewrapper.py + tests/openssl_test.py + tests/os_test.py + tests/parse_results.py +@@ -269,4 +268,4 @@ tests/stdlib/test_threading_local.py + tests/stdlib/test_timeout.py + tests/stdlib/test_urllib.py + tests/stdlib/test_urllib2.py +-tests/stdlib/test_urllib2_localnet.py +\ No newline at end of file ++tests/stdlib/test_urllib2_localnet.py +--- a/tests/greenio_test.py ++++ b/tests/greenio_test.py +@@ -9,8 +9,6 @@ import socket as _orig_sock + import sys + import tempfile + +-from nose.tools import eq_ +- + import eventlet + from eventlet import event, greenio, debug + from eventlet.hubs import get_hub +@@ -39,7 +37,7 @@ def expect_socket_timeout(function, *arg + raise AssertionError("socket.timeout not raised") + except socket.timeout as e: + assert hasattr(e, 'args') +- eq_(e.args[0], 'timed out') ++ assert e.args[0] == 'timed out' + + + def min_buf_size(): +@@ -671,8 +669,8 @@ class TestGreenSocket(tests.LimitedTestC + sender.sendto(b'second', 0, address) + + sender_address = ('127.0.0.1', sender.getsockname()[1]) +- eq_(receiver.recvfrom(1024), (b'first', sender_address)) +- eq_(receiver.recvfrom(1024), (b'second', sender_address)) ++ assert receiver.recvfrom(1024) == (b'first', sender_address) ++ assert receiver.recvfrom(1024) == (b'second', sender_address) + + + def test_get_fileno_of_a_socket_works(): +--- a/tests/nosewrapper.py ++++ b/tests/nosewrapper.py +@@ -1,20 +1,13 @@ + """ This script simply gets the paths correct for testing eventlet with the + hub extension for Nose.""" +-import nose + from os.path import dirname, realpath, abspath + import sys ++import unittest + + + parent_dir = dirname(dirname(realpath(abspath(__file__)))) + if parent_dir not in sys.path: + sys.path.insert(0, parent_dir) + +-# hudson does a better job printing the test results if the exit value is 0 +-zero_status = '--force-zero-status' +-if zero_status in sys.argv: +- sys.argv.remove(zero_status) +- launch = nose.run +-else: +- launch = nose.main +- +-launch(argv=sys.argv) ++if __name__ == '__main__': ++ unittest.main() +--- a/tests/__init__.py ++++ b/tests/__init__.py +@@ -20,7 +20,7 @@ import sys + import unittest + import warnings + +-from nose.plugins.skip import SkipTest ++from unittest import SkipTest + + import eventlet + from eventlet import tpool +@@ -223,7 +223,6 @@ class LimitedTestCase(unittest.TestCase) + def check_idle_cpu_usage(duration, allowed_part): + if resource is None: + # TODO: use https://code.google.com/p/psutil/ +- from nose.plugins.skip import SkipTest + raise SkipTest('CPU usage testing not supported (`import resource` failed)') + + r1 = resource.getrusage(resource.RUSAGE_SELF) +--- a/tests/dagpool_test.py ++++ b/tests/dagpool_test.py +@@ -5,7 +5,6 @@ + @brief Test DAGPool class + """ + +-from nose.tools import * + import eventlet + from eventlet.dagpool import DAGPool, Collision, PropagateError + import six +@@ -13,8 +12,8 @@ from contextlib import contextmanager + import itertools + + +-# Not all versions of nose.tools.assert_raises() support the usage in this +-# module, but it's straightforward enough to code that explicitly. ++# Not all versions of assert_raises() support the usage in this module, ++# but it's straightforward enough to code that explicitly. + @contextmanager + def assert_raises(exc): + """exc is an exception class"""