Skip to content

Commit c9ffb9d

Browse files
authored
Merge branch 'micropython:master' into master
2 parents 299da14 + e4cf095 commit c9ffb9d

File tree

9 files changed

+33
-13
lines changed

9 files changed

+33
-13
lines changed

micropython/aioespnow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A small async server example::
5555
import asyncio
5656

5757
# A WLAN interface must be active to send()/recv()
58-
network.WLAN(network.STA_IF).active(True)
58+
network.WLAN(network.WLAN.IF_STA).active(True)
5959

6060
e = aioespnow.AIOESPNow() # Returns AIOESPNow enhanced with async support
6161
e.active(True)

micropython/net/webrepl/webrepl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def setup_conn(port, accept_handler):
102102
listen_s.listen(1)
103103
if accept_handler:
104104
listen_s.setsockopt(socket.SOL_SOCKET, 20, accept_handler)
105-
for i in (network.AP_IF, network.STA_IF):
105+
for i in (network.WLAN.IF_AP, network.WLAN.IF_STA):
106106
iface = network.WLAN(i)
107107
if iface.active():
108108
print("WebREPL server started on http://%s:%d/" % (iface.ifconfig()[0], port))

micropython/umqtt.simple/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(description="Lightweight MQTT client for MicroPython.", version="1.4.0")
1+
metadata(description="Lightweight MQTT client for MicroPython.", version="1.5.0")
22

33
# Originally written by Paul Sokolovsky.
44

micropython/umqtt.simple/umqtt/simple.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ def set_last_will(self, topic, msg, retain=False, qos=0):
6060
self.lw_qos = qos
6161
self.lw_retain = retain
6262

63-
def connect(self, clean_session=True):
63+
def connect(self, clean_session=True, timeout=None):
6464
self.sock = socket.socket()
65+
self.sock.settimeout(timeout)
6566
addr = socket.getaddrinfo(self.server, self.port)[0][-1]
6667
self.sock.connect(addr)
6768
if self.ssl:

python-stdlib/unittest/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
metadata(version="0.10.3")
1+
metadata(version="0.10.4")
22

33
package("unittest")

python-stdlib/unittest/tests/test_exception.py renamed to python-stdlib/unittest/tests/exception.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This makes unittest return an error code, so is not named "test_xxx.py".
2+
13
import unittest
24

35

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import unittest
2+
3+
4+
class Test(unittest.TestCase):
5+
def test_subtest_skip(self):
6+
for i in range(4):
7+
with self.subTest(i=i):
8+
print("sub test", i)
9+
if i == 2:
10+
self.skipTest("skip 2")
11+
12+
13+
if __name__ == "__main__":
14+
unittest.main()

python-stdlib/unittest/unittest/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def assertRaises(self, exc, func=None, *args, **kwargs):
198198
except Exception as e:
199199
if isinstance(e, exc):
200200
return
201-
raise
201+
raise e
202202

203203
assert False, "%r not raised" % exc
204204

@@ -348,7 +348,13 @@ def _handle_test_exception(
348348
exc = exc_info[1]
349349
traceback = exc_info[2]
350350
ex_str = _capture_exc(exc, traceback)
351-
if isinstance(exc, AssertionError):
351+
if isinstance(exc, SkipTest):
352+
reason = exc.args[0]
353+
test_result.skippedNum += 1
354+
test_result.skipped.append((current_test, reason))
355+
print(" skipped:", reason)
356+
return
357+
elif isinstance(exc, AssertionError):
352358
test_result.failuresNum += 1
353359
test_result.failures.append((current_test, ex_str))
354360
if verbose:
@@ -396,17 +402,12 @@ def run_one(test_function):
396402
print(" FAIL")
397403
else:
398404
print(" ok")
399-
except SkipTest as e:
400-
reason = e.args[0]
401-
print(" skipped:", reason)
402-
test_result.skippedNum += 1
403-
test_result.skipped.append((name, c, reason))
404405
except Exception as ex:
405406
_handle_test_exception(
406407
current_test=(name, c), test_result=test_result, exc_info=(type(ex), ex, None)
407408
)
408409
# Uncomment to investigate failure in detail
409-
# raise
410+
# raise ex
410411
finally:
411412
__test_result__ = None
412413
__current_test__ = None

tools/ci.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function ci_package_tests_run {
6363
python-stdlib/os-path/test_path.py \
6464
python-stdlib/pickle/test_pickle.py \
6565
python-stdlib/string/test_translate.py \
66+
python-stdlib/unittest/tests/exception.py \
6667
unix-ffi/gettext/test_gettext.py \
6768
unix-ffi/pwd/test_getpwnam.py \
6869
unix-ffi/re/test_re.py \
@@ -90,6 +91,7 @@ function ci_package_tests_run {
9091
python-stdlib/shutil \
9192
python-stdlib/tempfile \
9293
python-stdlib/time \
94+
python-stdlib/unittest/tests \
9395
python-stdlib/unittest-discover/tests \
9496
; do
9597
(cd $path && $MICROPYTHON -m unittest)

0 commit comments

Comments
 (0)