[pypy-commit] pypy default: move failing tests that mess up global state to end so they do not cause other failures
mattip
noreply at buildbot.pypy.org
Mon Jun 16 21:43:22 CEST 2014
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r72080:8830a6fd5a51
Date: 2014-06-16 22:40 +0300
http://bitbucket.org/pypy/pypy/changeset/8830a6fd5a51/
Log: move failing tests that mess up global state to end so they do not
cause other failures
diff --git a/rpython/rlib/test/test_rsocket.py b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -62,43 +62,6 @@
py.test.fail("could not find the localhost address in %r"
% (address_list,))
-def test_thread_safe_gethostbyname_ex():
- import threading
- nthreads = 10
- domain = 'google.com'
- result = [0] * nthreads
- threads = [None] * nthreads
- lock = threading.Lock()
- def lookup_name(i):
- name, aliases, address_list = gethostbyname_ex(domain, lock)
- if name == domain:
- result[i] += 1
- for i in range(nthreads):
- threads[i] = threading.Thread(target = lookup_name, args=[i])
- threads[i].start()
- for i in range(nthreads):
- threads[i].join()
- assert sum(result) == nthreads
-
-def test_thread_safe_gethostbyaddr():
- import threading
- nthreads = 10
- ip = '8.8.8.8'
- domain = gethostbyaddr(ip)[0]
- result = [0] * nthreads
- threads = [None] * nthreads
- lock = threading.Lock()
- def lookup_addr(ip, i):
- name, aliases, address_list = gethostbyaddr(ip, lock)
- if name == domain:
- result[i] += 1
- for i in range(nthreads):
- threads[i] = threading.Thread(target = lookup_addr, args=[ip, i])
- threads[i].start()
- for i in range(nthreads):
- threads[i].join()
- assert sum(result) == nthreads
-
def test_gethostbyaddr():
try:
cpy_socket.gethostbyaddr("::1")
@@ -356,18 +319,7 @@
getaddrinfo_pydotorg(0, result)
assert result[0] == 1
-def test_getaddrinfo_pydotorg_threadsafe():
- import threading
- nthreads = 10
- result = [0] * nthreads
- threads = [None] * nthreads
- for i in range(nthreads):
- threads[i] = threading.Thread(target = getaddrinfo_pydotorg, args=[i, result])
- threads[i].start()
- for i in range(nthreads):
- threads[i].join()
- assert sum(result) == nthreads
-
+
def test_getaddrinfo_no_reverse_lookup():
# It seems that getaddrinfo never runs a reverse lookup on Linux.
# Python2.3 on Windows returns the hostname.
@@ -566,3 +518,53 @@
def test_no_AF_NETLINK():
_test_cond_include('AF_NETLINK')
+
+def test_thread_safe_gethostbyaddr():
+ import threading
+ nthreads = 10
+ ip = '8.8.8.8'
+ domain = gethostbyaddr(ip)[0]
+ result = [0] * nthreads
+ threads = [None] * nthreads
+ lock = threading.Lock()
+ def lookup_addr(ip, i):
+ name, aliases, address_list = gethostbyaddr(ip, lock)
+ if name == domain:
+ result[i] += 1
+ for i in range(nthreads):
+ threads[i] = threading.Thread(target = lookup_addr, args=[ip, i])
+ threads[i].start()
+ for i in range(nthreads):
+ threads[i].join()
+ assert sum(result) == nthreads
+
+def test_thread_safe_gethostbyname_ex():
+ import threading
+ nthreads = 10
+ domain = 'google.com'
+ result = [0] * nthreads
+ threads = [None] * nthreads
+ lock = threading.Lock()
+ def lookup_name(i):
+ name, aliases, address_list = gethostbyname_ex(domain, lock)
+ if name == domain:
+ result[i] += 1
+ for i in range(nthreads):
+ threads[i] = threading.Thread(target = lookup_name, args=[i])
+ threads[i].start()
+ for i in range(nthreads):
+ threads[i].join()
+ assert sum(result) == nthreads
+
+def test_getaddrinfo_pydotorg_threadsafe():
+ import threading
+ nthreads = 10
+ result = [0] * nthreads
+ threads = [None] * nthreads
+ for i in range(nthreads):
+ threads[i] = threading.Thread(target = getaddrinfo_pydotorg, args=[i, result])
+ threads[i].start()
+ for i in range(nthreads):
+ threads[i].join()
+ assert sum(result) == nthreads
+
More information about the pypy-commit
mailing list