summaryrefslogtreecommitdiff
path: root/tests/net_hosted
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-04-22 19:32:21 +1000
committerDamien George <damien@micropython.org>2021-04-23 22:03:46 +1000
commit3123f6918ba18b0a3f7a89500b450f4cb15e1aee (patch)
tree0916d58b5685fdfcf968004621b7766d3b2046fd /tests/net_hosted
parent342d55529d6f3312fc158d7af005f56d5e30adef (diff)
tests: Use .errno instead of .args[0] for OSError exceptions.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/net_hosted')
-rw-r--r--tests/net_hosted/accept_nonblock.py2
-rw-r--r--tests/net_hosted/accept_timeout.py2
-rw-r--r--tests/net_hosted/connect_nonblock.py2
-rw-r--r--tests/net_hosted/connect_nonblock_xfer.py10
4 files changed, 8 insertions, 8 deletions
diff --git a/tests/net_hosted/accept_nonblock.py b/tests/net_hosted/accept_nonblock.py
index 941965e17..d17e28749 100644
--- a/tests/net_hosted/accept_nonblock.py
+++ b/tests/net_hosted/accept_nonblock.py
@@ -12,5 +12,5 @@ s.listen(1)
try:
s.accept()
except OSError as er:
- print(er.args[0] == 11) # 11 is EAGAIN
+ print(er.errno == 11) # 11 is EAGAIN
s.close()
diff --git a/tests/net_hosted/accept_timeout.py b/tests/net_hosted/accept_timeout.py
index 5f528d557..734fe217c 100644
--- a/tests/net_hosted/accept_timeout.py
+++ b/tests/net_hosted/accept_timeout.py
@@ -18,5 +18,5 @@ s.listen(1)
try:
s.accept()
except OSError as er:
- print(er.args[0] in (errno.ETIMEDOUT, "timed out")) # CPython uses a string instead of errno
+ print(er.errno in (errno.ETIMEDOUT, "timed out")) # CPython uses a string instead of errno
s.close()
diff --git a/tests/net_hosted/connect_nonblock.py b/tests/net_hosted/connect_nonblock.py
index c024b65a0..4b8055c16 100644
--- a/tests/net_hosted/connect_nonblock.py
+++ b/tests/net_hosted/connect_nonblock.py
@@ -13,7 +13,7 @@ def test(peer_addr):
try:
s.connect(peer_addr)
except OSError as er:
- print(er.args[0] == errno.EINPROGRESS)
+ print(er.errno == errno.EINPROGRESS)
s.close()
diff --git a/tests/net_hosted/connect_nonblock_xfer.py b/tests/net_hosted/connect_nonblock_xfer.py
index feb648ea0..1a0b24227 100644
--- a/tests/net_hosted/connect_nonblock_xfer.py
+++ b/tests/net_hosted/connect_nonblock_xfer.py
@@ -25,9 +25,9 @@ def do_connect(peer_addr, tls, handshake):
# print("Connecting to", peer_addr)
s.connect(peer_addr)
except OSError as er:
- print("connect:", er.args[0] == errno.EINPROGRESS)
- if er.args[0] != errno.EINPROGRESS:
- print(" got", er.args[0])
+ print("connect:", er.errno == errno.EINPROGRESS)
+ if er.errno != errno.EINPROGRESS:
+ print(" got", er.errno)
# wrap with ssl/tls if desired
if tls:
try:
@@ -67,7 +67,7 @@ def test(peer_addr, tls=False, handshake=False):
except OSError as er:
#
dp(er)
- print("send:", er.args[0] in (errno.EAGAIN, errno.EINPROGRESS))
+ print("send:", er.errno in (errno.EAGAIN, errno.EINPROGRESS))
s.close()
else: # fake it...
print("connect:", True)
@@ -103,7 +103,7 @@ def test(peer_addr, tls=False, handshake=False):
print("recv:", s.recv(10))
except OSError as er:
dp(er)
- print("recv:", er.args[0] == errno.EAGAIN)
+ print("recv:", er.errno == errno.EAGAIN)
s.close()
else: # fake it...
print("connect:", True)