forked from pool/python-eventlet
Accepting request 827530 from home:jayvdb:branches:devel:languages:python
- Add pr_639.patch which fixes eventlet using dnspython 2.0.0 - Add remove_nose_part_2.patch to complete the removal of nose - Activate test suite with 958 test cases passing on Tumbleweed OBS-URL: https://build.opensuse.org/request/show/827530 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-eventlet?expand=0&rev=73
This commit is contained in:
51
pr_639.patch
Normal file
51
pr_639.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
commit 46fc185c8f92008c65aef2713fc1445bfc5f6fec
|
||||
Author: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
|
||||
Date: Mon Jul 20 17:21:30 2020 +0000
|
||||
|
||||
Replace dnspython "_compute_expiration" by "_compute_times".
|
||||
|
||||
In dnspython v2.0.0, "_compute_expiration" was replaced by
|
||||
"_compute_times". Once the minimum version of dnspython is
|
||||
v2.0.0, we can remove this wrapping method.
|
||||
|
||||
Closes-Bug: #1888258
|
||||
Fixes: #629
|
||||
|
||||
diff --git a/eventlet/support/greendns.py b/eventlet/support/greendns.py
|
||||
index 13968c2..19b83c9 100644
|
||||
--- a/eventlet/support/greendns.py
|
||||
+++ b/eventlet/support/greendns.py
|
||||
@@ -118,6 +118,15 @@ def is_ip_addr(host):
|
||||
return is_ipv4_addr(host) or is_ipv6_addr(host)
|
||||
|
||||
|
||||
+def compute_expiration(query, timeout):
|
||||
+ # NOTE(ralonsoh): in dnspython v2.0.0, "_compute_expiration" was replaced
|
||||
+ # by "_compute_times".
|
||||
+ if hasattr(query, '_compute_expiration'):
|
||||
+ return query._compute_expiration(timeout)
|
||||
+ else:
|
||||
+ return query._compute_times(timeout)[1]
|
||||
+
|
||||
+
|
||||
class HostsAnswer(dns.resolver.Answer):
|
||||
"""Answer class for HostsResolver object"""
|
||||
|
||||
@@ -709,7 +718,7 @@ def udp(q, where, timeout=DNS_QUERY_TIMEOUT, port=53,
|
||||
s = socket.socket(af, socket.SOCK_DGRAM)
|
||||
s.settimeout(timeout)
|
||||
try:
|
||||
- expiration = dns.query._compute_expiration(timeout)
|
||||
+ expiration = compute_expiration(dns.query, timeout)
|
||||
if source is not None:
|
||||
s.bind(source)
|
||||
while True:
|
||||
@@ -802,7 +811,7 @@ def tcp(q, where, timeout=DNS_QUERY_TIMEOUT, port=53,
|
||||
s = socket.socket(af, socket.SOCK_STREAM)
|
||||
s.settimeout(timeout)
|
||||
try:
|
||||
- expiration = dns.query._compute_expiration(timeout)
|
||||
+ expiration = compute_expiration(dns.query, timeout)
|
||||
if source is not None:
|
||||
s.bind(source)
|
||||
while True:
|
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 17 09:38:44 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
|
||||
|
||||
- Add pr_639.patch which fixes eventlet using dnspython 2.0.0
|
||||
- Add remove_nose_part_2.patch to complete the removal of nose
|
||||
- Activate test suite with 958 test cases passing on Tumbleweed
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 17 07:49:25 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@@ -31,10 +31,16 @@ Patch0: remove_nose.patch
|
||||
# PATCH-FIX-UPSTREAM newdnspythis patch makes things totally awesomethon.patch gh#eventlet/eventlet#638 mcepl@suse.com
|
||||
# patch is from gh#rthalley/dnspython#519
|
||||
Patch1: newdnspython.patch
|
||||
# PATCH-FEATURE-UPSTREAM pr_639.patch gh#eventlet/eventlet#639 jayvdb@gmail.com
|
||||
Patch2: pr_639.patch
|
||||
# Really remove the dependency on nose
|
||||
Patch3: remove_nose_part_2.patch
|
||||
BuildRequires: %{python_module dnspython >= 1.15.0}
|
||||
BuildRequires: %{python_module greenlet >= 0.3}
|
||||
BuildRequires: %{python_module monotonic >= 1.4}
|
||||
BuildRequires: %{python_module pyOpenSSL}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module pyzmq}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module six >= 1.10.0}
|
||||
BuildRequires: %{python_module testsuite}
|
||||
@@ -43,7 +49,6 @@ 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-dnspython >= 1.15.0
|
||||
@@ -69,6 +74,45 @@ interpreter, or as part of a larger application.
|
||||
|
||||
sed -i "s|^#!.*||" eventlet/support/greendns.py # Fix non-executable script
|
||||
|
||||
# As of 2020-08, upstream is not running their tests/stdlib tests in CI
|
||||
|
||||
# test setup fails
|
||||
rm \
|
||||
tests/nosewrapper.py \
|
||||
tests/stdlib/all.py \
|
||||
tests/stdlib/all_modules.py \
|
||||
tests/stdlib/test_SimpleHTTPServer.py \
|
||||
tests/stdlib/test_httpservers.py \
|
||||
tests/stdlib/test_socket_ssl.py \
|
||||
tests/stdlib/test_socketserver.py \
|
||||
tests/stdlib/test_ssl.py \
|
||||
tests/stdlib/test_thread__boundedsem.py \
|
||||
tests/stdlib/test_urllib*.py
|
||||
|
||||
# large percentage errors
|
||||
rm \
|
||||
tests/backdoor_test.py \
|
||||
tests/stdlib/test_asyncore.py \
|
||||
tests/stdlib/test_ftplib.py \
|
||||
tests/stdlib/test_select.py
|
||||
|
||||
# Too slow, possibly hanging
|
||||
rm \
|
||||
tests/stdlib/test_queue.py \
|
||||
tests/stdlib/test_socket.py \
|
||||
tests/stdlib/test_subprocess.py \
|
||||
tests/stdlib/test_threading.py
|
||||
|
||||
# Unknown openSUSE 15.x specific errors, including a few not in tests/stdlib:
|
||||
|
||||
# TypeError: _wrap_socket() argument 1 must be _socket.socket, not SSLSocket
|
||||
# https://github.com/rthalley/dnspython/issues/559#issuecomment-675274960
|
||||
if [[ "%python3_version_nodots" == "36" ]]; then
|
||||
rm \
|
||||
tests/api_test.py tests/convenience_test.py tests/ssl_test.py tests/websocket_test.py tests/websocket_new_test.py tests/wsgi_test.py \
|
||||
tests/stdlib/test_httplib.py tests/stdlib/test_thread.py
|
||||
fi
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
@@ -77,8 +121,21 @@ sed -i "s|^#!.*||" eventlet/support/greendns.py # Fix non-executable script
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
# All tests fail (gh#eventlet/eventlet#638), we are now on 8 errors
|
||||
%pytest || /bin/true
|
||||
export EVENTLET_HUB=selects
|
||||
|
||||
# test_raise_dns_tcp and test_noraise_dns_tcp likely minor dnspython 2 incompatibility
|
||||
# test_dns_methods_are_green fails because socket_resolve_green.py
|
||||
# emits "name: test-host0. error: [Errno -2] Name or service not known"
|
||||
# second set of test failures are the stdlib tests
|
||||
|
||||
# Python 2 has many failures upstream also, that are not being actively fixed.
|
||||
# They are mostly related to the test harness, rather than the library.
|
||||
# e.g. https://github.com/eventlet/eventlet/issues/641
|
||||
%{python_expand if [[ "$python" != "python2" ]]; then
|
||||
export PYTHONPATH=%{buildroot}%{$python_sitelib}
|
||||
$python -m pytest -rs -vv --ignore tests/manual -k 'not (test_raise_dns_tcp or test_noraise_dns_tcp or test_dns_methods_are_green) and not (test_get_exec_path or test_internal_execvpe_str or test_open_keywords or test_locked_repr or test_repr or test_timeout or test_unraisable_exception or ExceptHookTests or test_interrupt_main_noerror or test_threading_local)'
|
||||
fi
|
||||
}
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
|
301
remove_nose_part_2.patch
Normal file
301
remove_nose_part_2.patch
Normal file
@@ -0,0 +1,301 @@
|
||||
diff -ur eventlet-0.26.1-orig/tests/dagpool_test.py eventlet-0.26.1/tests/dagpool_test.py
|
||||
--- eventlet-0.26.1-orig/tests/dagpool_test.py 2020-08-17 16:48:04.393065291 +0700
|
||||
+++ eventlet-0.26.1/tests/dagpool_test.py 2020-08-17 16:48:42.049502450 +0700
|
||||
@@ -162,7 +162,7 @@
|
||||
# a set. Make a set containing its elements.
|
||||
setlist.append(set(subseq))
|
||||
# Now that we've massaged 'sequence' into 'setlist', compare.
|
||||
- assert_equal(self.sequence, setlist)
|
||||
+ assert self.sequence == setlist
|
||||
|
||||
|
||||
# ****************************************************************************
|
||||
@@ -190,14 +190,14 @@
|
||||
with check_no_suspend():
|
||||
results = pool.waitall()
|
||||
# with no spawn() or post(), waitall() returns preload data
|
||||
- assert_equals(results, dict(a=1, b=2, c=3))
|
||||
+ assert results == dict(a=1, b=2, c=3)
|
||||
|
||||
# preload sequence of pairs
|
||||
pool = DAGPool([("d", 4), ("e", 5), ("f", 6)])
|
||||
# this must not hang
|
||||
with check_no_suspend():
|
||||
results = pool.waitall()
|
||||
- assert_equals(results, dict(d=4, e=5, f=6))
|
||||
+ assert results == dict(d=4, e=5, f=6)
|
||||
|
||||
|
||||
def test_wait_each_empty():
|
||||
@@ -215,10 +215,10 @@
|
||||
with check_no_suspend():
|
||||
# wait_each() may deliver in arbitrary order; collect into a dict
|
||||
# for comparison
|
||||
- assert_equals(dict(pool.wait_each("abc")), dict(a=1, b=2, c=3))
|
||||
+ assert dict(pool.wait_each("abc")) == dict(a=1, b=2, c=3)
|
||||
|
||||
# while we're at it, test wait() for preloaded keys
|
||||
- assert_equals(pool.wait("bc"), dict(b=2, c=3))
|
||||
+ assert pool.wait("bc") == dict(b=2, c=3)
|
||||
|
||||
|
||||
def post_each(pool, capture):
|
||||
@@ -256,7 +256,7 @@
|
||||
eventlet.spawn(post_each, pool, capture)
|
||||
gotten = pool.wait("bcdefg")
|
||||
capture.add("got all")
|
||||
- assert_equals(gotten,
|
||||
+ assert (gotten ==
|
||||
dict(b=2, c=3,
|
||||
d="dval", e="eval",
|
||||
f="fval", g="gval"))
|
||||
@@ -284,7 +284,7 @@
|
||||
pool = DAGPool()
|
||||
pool.spawn("a", (), lambda key, results: "aval")
|
||||
# hasn't yet even started
|
||||
- assert_equals(pool.get("a"), None)
|
||||
+ assert pool.get("a") == None
|
||||
with assert_raises(Collision):
|
||||
# Attempting to spawn again with same key should collide even if the
|
||||
# first spawned greenthread hasn't yet had a chance to run.
|
||||
@@ -292,7 +292,7 @@
|
||||
# now let the spawned eventlet run
|
||||
eventlet.sleep(0)
|
||||
# should have finished
|
||||
- assert_equals(pool.get("a"), "aval")
|
||||
+ assert pool.get("a") == "aval"
|
||||
with assert_raises(Collision):
|
||||
# Attempting to spawn with same key collides even when the greenthread
|
||||
# has completed.
|
||||
@@ -323,60 +323,60 @@
|
||||
capture.step()
|
||||
# but none of them has yet produced a result
|
||||
for k in "defgh":
|
||||
- assert_equals(pool.get(k), None)
|
||||
- assert_equals(set(pool.keys()), set("abc"))
|
||||
- assert_equals(dict(pool.items()), dict(a=1, b=2, c=3))
|
||||
- assert_equals(pool.running(), 5)
|
||||
- assert_equals(set(pool.running_keys()), set("defgh"))
|
||||
- assert_equals(pool.waiting(), 1)
|
||||
- assert_equals(pool.waiting_for(), dict(h=set("defg")))
|
||||
- assert_equals(pool.waiting_for("d"), set())
|
||||
- assert_equals(pool.waiting_for("c"), set())
|
||||
+ assert pool.get(k) == None
|
||||
+ assert set(pool.keys()) == set("abc")
|
||||
+ assert dict(pool.items()) == dict(a=1, b=2, c=3)
|
||||
+ assert pool.running() == 5
|
||||
+ assert set(pool.running_keys()) == set("defgh")
|
||||
+ assert pool.waiting() == 1
|
||||
+ assert pool.waiting_for() == dict(h=set("defg"))
|
||||
+ assert pool.waiting_for("d") == set()
|
||||
+ assert pool.waiting_for("c") == set()
|
||||
with assert_raises(KeyError):
|
||||
pool.waiting_for("j")
|
||||
- assert_equals(pool.waiting_for("h"), set("defg"))
|
||||
+ assert pool.waiting_for("h") == set("defg")
|
||||
|
||||
# let one of the upstream greenthreads complete
|
||||
events["f"].send("fval")
|
||||
spin()
|
||||
capture.step()
|
||||
- assert_equals(pool.get("f"), "fval")
|
||||
- assert_equals(set(pool.keys()), set("abcf"))
|
||||
- assert_equals(dict(pool.items()), dict(a=1, b=2, c=3, f="fval"))
|
||||
- assert_equals(pool.running(), 4)
|
||||
- assert_equals(set(pool.running_keys()), set("degh"))
|
||||
- assert_equals(pool.waiting(), 1)
|
||||
- assert_equals(pool.waiting_for("h"), set("deg"))
|
||||
+ assert pool.get("f") == "fval"
|
||||
+ assert set(pool.keys()) == set("abcf")
|
||||
+ assert dict(pool.items()) == dict(a=1, b=2, c=3, f="fval")
|
||||
+ assert pool.running() == 4
|
||||
+ assert set(pool.running_keys()) == set("degh")
|
||||
+ assert pool.waiting() == 1
|
||||
+ assert pool.waiting_for("h") == set("deg")
|
||||
|
||||
# now two others
|
||||
events["e"].send("eval")
|
||||
events["g"].send("gval")
|
||||
spin()
|
||||
capture.step()
|
||||
- assert_equals(pool.get("e"), "eval")
|
||||
- assert_equals(pool.get("g"), "gval")
|
||||
- assert_equals(set(pool.keys()), set("abcefg"))
|
||||
- assert_equals(dict(pool.items()),
|
||||
+ assert pool.get("e") == "eval"
|
||||
+ assert pool.get("g") == "gval"
|
||||
+ assert set(pool.keys()) == set("abcefg")
|
||||
+ assert (dict(pool.items()) ==
|
||||
dict(a=1, b=2, c=3, e="eval", f="fval", g="gval"))
|
||||
- assert_equals(pool.running(), 2)
|
||||
- assert_equals(set(pool.running_keys()), set("dh"))
|
||||
- assert_equals(pool.waiting(), 1)
|
||||
- assert_equals(pool.waiting_for("h"), set("d"))
|
||||
+ assert pool.running() == 2
|
||||
+ assert set(pool.running_keys()) == set("dh")
|
||||
+ assert pool.waiting() == 1
|
||||
+ assert pool.waiting_for("h") == set("d")
|
||||
|
||||
# last one
|
||||
events["d"].send("dval")
|
||||
# make sure both pool greenthreads get a chance to run
|
||||
spin()
|
||||
capture.step()
|
||||
- assert_equals(pool.get("d"), "dval")
|
||||
- assert_equals(set(pool.keys()), set("abcdefgh"))
|
||||
- assert_equals(dict(pool.items()),
|
||||
+ assert pool.get("d") == "dval"
|
||||
+ assert set(pool.keys()) == set("abcdefgh")
|
||||
+ assert (dict(pool.items()) ==
|
||||
dict(a=1, b=2, c=3,
|
||||
d="dval", e="eval", f="fval", g="gval", h="hval"))
|
||||
- assert_equals(pool.running(), 0)
|
||||
- assert_false(pool.running_keys())
|
||||
- assert_equals(pool.waiting(), 0)
|
||||
- assert_equals(pool.waiting_for("h"), set())
|
||||
+ assert pool.running() == 0
|
||||
+ assert not pool.running_keys()
|
||||
+ assert pool.waiting() == 0
|
||||
+ assert pool.waiting_for("h") == set()
|
||||
|
||||
capture.validate([
|
||||
["h got b", "h got c"],
|
||||
@@ -431,13 +431,13 @@
|
||||
spin()
|
||||
# verify that e completed (also that post(key) within greenthread
|
||||
# overrides implicit post of return value, which would be None)
|
||||
- assert_equals(pool.get("e"), "e")
|
||||
+ assert pool.get("e") == "e"
|
||||
|
||||
# With the dependency graph shown above, it is not guaranteed whether b or
|
||||
# c will complete first. Handle either case.
|
||||
sequence = capture.sequence[:]
|
||||
sequence[1:3] = [set([sequence[1].pop(), sequence[2].pop()])]
|
||||
- assert_equals(sequence,
|
||||
+ assert (sequence ==
|
||||
[set(["a done"]),
|
||||
set(["b done", "c done"]),
|
||||
set(["d done"]),
|
||||
@@ -465,7 +465,7 @@
|
||||
for pos in range(len(keys)):
|
||||
# next value from wait_each()
|
||||
k, v = next(each)
|
||||
- assert_equals(k, keys[pos])
|
||||
+ assert k == keys[pos]
|
||||
# advance every pool greenlet as far as it can go
|
||||
spin()
|
||||
# everything from keys[:pos+1] should have a value by now
|
||||
@@ -493,7 +493,7 @@
|
||||
pool.kill("a")
|
||||
# didn't run
|
||||
spin()
|
||||
- assert_equals(pool.get("a"), None)
|
||||
+ assert pool.get("a") == None
|
||||
# killing it forgets about it
|
||||
with assert_raises(KeyError):
|
||||
pool.kill("a")
|
||||
@@ -504,7 +504,7 @@
|
||||
with assert_raises(KeyError):
|
||||
pool.kill("a")
|
||||
# verify it ran to completion
|
||||
- assert_equals(pool.get("a"), 2)
|
||||
+ assert pool.get("a") == 2
|
||||
|
||||
|
||||
def test_post_collision_preload():
|
||||
@@ -532,7 +532,7 @@
|
||||
pool.kill("a")
|
||||
# now we can post
|
||||
pool.post("a", 3)
|
||||
- assert_equals(pool.get("a"), 3)
|
||||
+ assert pool.get("a") == 3
|
||||
|
||||
pool = DAGPool()
|
||||
pool.spawn("a", (), lambda key, result: 4)
|
||||
@@ -552,10 +552,10 @@
|
||||
pool = DAGPool()
|
||||
pool.post("a", 1)
|
||||
pool.post("a", 2, replace=True)
|
||||
- assert_equals(pool.get("a"), 2)
|
||||
- assert_equals(dict(pool.wait_each("a")), dict(a=2))
|
||||
- assert_equals(pool.wait("a"), dict(a=2))
|
||||
- assert_equals(pool["a"], 2)
|
||||
+ assert pool.get("a") == 2
|
||||
+ assert dict(pool.wait_each("a")) == dict(a=2)
|
||||
+ assert pool.wait("a") == dict(a=2)
|
||||
+ assert pool["a"] == 2
|
||||
|
||||
|
||||
def waitfor(capture, pool, key):
|
||||
@@ -597,14 +597,14 @@
|
||||
try:
|
||||
pool.waitall()
|
||||
except PropagateError as err:
|
||||
- assert_equals(err.key, "a")
|
||||
+ assert err.key == "a"
|
||||
assert isinstance(err.exc, BogusError), \
|
||||
"exc attribute is {0}, not BogusError".format(err.exc)
|
||||
- assert_equals(str(err.exc), "bogus")
|
||||
+ assert str(err.exc) == "bogus"
|
||||
msg = str(err)
|
||||
- assert_in("PropagateError(a)", msg)
|
||||
- assert_in("BogusError", msg)
|
||||
- assert_in("bogus", msg)
|
||||
+ assert "PropagateError(a)" in msg
|
||||
+ assert "BogusError" in msg
|
||||
+ assert "bogus" in msg
|
||||
|
||||
|
||||
def test_propagate_exc():
|
||||
@@ -615,20 +615,20 @@
|
||||
try:
|
||||
pool["c"]
|
||||
except PropagateError as errc:
|
||||
- assert_equals(errc.key, "c")
|
||||
+ assert errc.key == "c"
|
||||
errb = errc.exc
|
||||
- assert_equals(errb.key, "b")
|
||||
+ assert errb.key == "b"
|
||||
erra = errb.exc
|
||||
- assert_equals(erra.key, "a")
|
||||
+ assert erra.key == "a"
|
||||
assert isinstance(erra.exc, BogusError), \
|
||||
"exc attribute is {0}, not BogusError".format(erra.exc)
|
||||
- assert_equals(str(erra.exc), "bogus")
|
||||
+ assert str(erra.exc) == "bogus"
|
||||
msg = str(errc)
|
||||
- assert_in("PropagateError(a)", msg)
|
||||
- assert_in("PropagateError(b)", msg)
|
||||
- assert_in("PropagateError(c)", msg)
|
||||
- assert_in("BogusError", msg)
|
||||
- assert_in("bogus", msg)
|
||||
+ assert "PropagateError(a)" in msg
|
||||
+ assert "PropagateError(b)" in msg
|
||||
+ assert "PropagateError(c)" in msg
|
||||
+ assert "BogusError" in msg
|
||||
+ assert "bogus" in msg
|
||||
|
||||
|
||||
def test_wait_each_exc():
|
||||
@@ -680,13 +680,13 @@
|
||||
pass
|
||||
|
||||
# wait_each_success() filters
|
||||
- assert_equals(dict(pool.wait_each_success()), dict(a=bogua))
|
||||
- assert_equals(dict(pool.wait_each_success("ab")), dict(a=bogua))
|
||||
- assert_equals(dict(pool.wait_each_success("a")), dict(a=bogua))
|
||||
- assert_equals(dict(pool.wait_each_success("b")), {})
|
||||
+ assert dict(pool.wait_each_success()) == dict(a=bogua)
|
||||
+ assert dict(pool.wait_each_success("ab")) == dict(a=bogua)
|
||||
+ assert dict(pool.wait_each_success("a")) == dict(a=bogua)
|
||||
+ assert dict(pool.wait_each_success("b")) == {}
|
||||
|
||||
# wait_each_exception() filters the other way
|
||||
- assert_equals(dict(pool.wait_each_exception()), dict(b=bogub))
|
||||
- assert_equals(dict(pool.wait_each_exception("ab")), dict(b=bogub))
|
||||
- assert_equals(dict(pool.wait_each_exception("a")), {})
|
||||
- assert_equals(dict(pool.wait_each_exception("b")), dict(b=bogub))
|
||||
+ assert dict(pool.wait_each_exception()) == dict(b=bogub)
|
||||
+ assert dict(pool.wait_each_exception("ab")) == dict(b=bogub)
|
||||
+ assert dict(pool.wait_each_exception("a")) == {}
|
||||
+ assert dict(pool.wait_each_exception("b")) == dict(b=bogub)
|
Reference in New Issue
Block a user