micropython/tests/basics
Damien George d8dc918deb py/compile: Handle return/break/continue correctly in async with.
Before this patch the context manager's __aexit__() method would not be
executed if a return/break/continue statement was used to exit an async
with block.  async with now has the same semantics as normal with.

The fix here applies purely to the compiler, and does not modify the
runtime at all. It might (eventually) be better to define new bytecode(s)
to handle async with (and maybe other async constructs) in a cleaner, more
efficient way.

One minor drawback with addressing this issue purely in the compiler is
that it wasn't possible to get 100% CPython semantics.  The thing that is
different here to CPython is that the __aexit__ method is not looked up in
the context manager until it is needed, which is after the body of the
async with statement has executed.  So if a context manager doesn't have
__aexit__ then CPython raises an exception before the async with is
executed, whereas uPy will raise it after it is executed.  Note that
__aenter__ is looked up at the beginning in uPy because it needs to be
called straightaway, so if the context manager isn't a context manager then
it'll still raise an exception at the same location as CPython.  The only
difference is if the context manager has the __aenter__ method but not the
__aexit__ method, then in that case uPy has different behaviour.  But this
is a very minor, and acceptable, difference.
2018-06-27 16:57:42 +10:00
..
0prelim.py
andor.py
array1.py
array_add.py
array_construct.py
array_construct2.py
array_construct_endian.py
array_intbig.py
array_micropython.py
array_micropython.py.exp
assign1.py
async_await.py
async_await.py.exp
async_await2.py
async_await2.py.exp
async_def.py
async_def.py.exp
async_for.py
async_for.py.exp
async_for2.py
async_for2.py.exp
async_with.py
async_with.py.exp
async_with2.py
async_with2.py.exp
async_with_break.py py/compile: Handle return/break/continue correctly in async with. 2018-06-27 16:57:42 +10:00
async_with_break.py.exp py/compile: Handle return/break/continue correctly in async with. 2018-06-27 16:57:42 +10:00
async_with_return.py py/compile: Handle return/break/continue correctly in async with. 2018-06-27 16:57:42 +10:00
async_with_return.py.exp py/compile: Handle return/break/continue correctly in async with. 2018-06-27 16:57:42 +10:00
attrtuple1.py
bool1.py
boundmeth1.py
break.py
builtin_abs.py
builtin_abs_intbig.py tests/basics: Add tests for edge cases of nan-box's 47-bit small int. 2018-04-05 00:59:49 +10:00
builtin_allany.py
builtin_bin.py
builtin_bin_intbig.py
builtin_callable.py
builtin_chr.py
builtin_compile.py tests: Fix few test for proper "skipped" detection with qemu-arm's tinytest. 2017-12-12 23:45:48 +02:00
builtin_delattr.py
builtin_dir.py py/modbuiltins: Simplify and generalise dir() by probing qstrs. 2018-02-19 16:12:44 +11:00
builtin_divmod.py
builtin_divmod_intbig.py
builtin_ellipsis.py
builtin_enumerate.py tests/basics/builtin_enumerate: Add test for many pos args to enumerate. 2018-03-08 12:51:06 +11:00
builtin_eval.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
builtin_eval_error.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
builtin_exec.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
builtin_filter.py tests/basics: Rename remaining tests that are for built-in functions. 2018-02-07 15:55:52 +11:00
builtin_getattr.py tests/basics: Rename remaining tests that are for built-in functions. 2018-02-07 15:55:52 +11:00
builtin_hasattr.py py/modbuiltins: Make built-in hasattr work properly for user types. 2018-05-10 23:03:30 +10:00
builtin_hash.py
builtin_hash_gen.py
builtin_hash_intbig.py tests: Add some tests for bigint hash, float hash and float parsing. 2018-05-21 13:05:40 +10:00
builtin_help.py
builtin_help.py.exp
builtin_hex.py
builtin_hex_intbig.py
builtin_id.py
builtin_issubclass.py
builtin_len1.py
builtin_locals.py
builtin_map.py tests/basics: Rename remaining tests that are for built-in functions. 2018-02-07 15:55:52 +11:00
builtin_minmax.py
builtin_oct.py
builtin_oct_intbig.py
builtin_ord.py
builtin_override.py
builtin_pow.py
builtin_pow3.py tests/basics/builtin_pow3: Add tests for edge cases of pow3. 2017-12-19 15:44:10 +11:00
builtin_pow3_intbig.py
builtin_print.py tests/basics: Rename remaining tests that are for built-in functions. 2018-02-07 15:55:52 +11:00
builtin_property.py py/objtype: Remove TODO comment about needing to check for property. 2018-05-25 10:59:40 +10:00
builtin_property_inherit.py py/objtype: Optimise instance get/set/del by skipping special accessors. 2018-06-08 12:12:08 +10:00
builtin_range.py
builtin_range_attrs.py
builtin_range_binop.py py/objrange: Implement (in)equality comparison between range objects. 2018-02-14 23:17:06 +11:00
builtin_reversed.py
builtin_round.py
builtin_round_int.py py/modbuiltins: Add support for rounding integers. 2018-05-22 14:18:16 +10:00
builtin_round_intbig.py py/modbuiltins: Add support for rounding integers. 2018-05-22 14:18:16 +10:00
builtin_setattr.py tests/basics: Rename remaining tests that are for built-in functions. 2018-02-07 15:55:52 +11:00
builtin_slice.py
builtin_sorted.py
builtin_sum.py
builtin_type.py py/objtype: Fix assertion failures in mp_obj_new_type by checking types. 2018-05-30 11:11:24 +10:00
builtin_zip.py tests/basics: Rename remaining tests that are for built-in functions. 2018-02-07 15:55:52 +11:00
bytearray1.py
bytearray_add.py
bytearray_append.py
bytearray_construct.py
bytearray_construct_array.py
bytearray_construct_endian.py
bytearray_intbig.py
bytearray_slice_assign.py
bytes.py py/objstr: Protect against creating bytes(n) with n negative. 2018-02-19 16:25:30 +11:00
bytes_add.py
bytes_add_array.py
bytes_add_endian.py
bytes_compare.py
bytes_compare2.py
bytes_compare3.py
bytes_compare3.py.exp
bytes_compare_array.py
bytes_construct.py
bytes_construct_array.py
bytes_construct_endian.py
bytes_construct_intbig.py
bytes_count.py
bytes_find.py
bytes_format_modulo.py
bytes_format_modulo.py.exp
bytes_gen.py
bytes_large.py
bytes_mult.py
bytes_partition.py
bytes_replace.py
bytes_split.py
bytes_strip.py
bytes_subscr.py
class1.py
class2.py
class3.py
class_bind_self.py
class_binop.py
class_call.py
class_contains.py
class_delattr_setattr.py
class_descriptor.py tests: Fix few test for proper "skipped" detection with qemu-arm's tinytest. 2017-12-12 23:45:48 +02:00
class_emptybases.py
class_getattr.py
class_inherit1.py
class_inherit_mul.py tests: Add tests to improve coverage of py/objtype.c. 2017-12-14 12:25:30 +11:00
class_inplace_op.py
class_instance_override.py
class_item.py
class_misc.py
class_new.py
class_notimpl.py
class_number.py
class_reverse_op.py
class_staticclassmethod.py
class_store.py
class_store_class.py
class_str.py
class_super.py py/objtype: Fix assertion failures in super_attr by checking type. 2018-05-30 11:14:07 +10:00
class_super_aslocal.py
class_super_closure.py
class_super_multinherit.py tests: Add tests to improve coverage of py/objtype.c. 2017-12-14 12:25:30 +11:00
class_super_object.py
class_use_other.py
closure1.py
closure2.py
closure_defargs.py
closure_manyvars.py
closure_namedarg.py
compare_multi.py
comprehension1.py
containment.py
continue.py
decorator.py
del_attr.py py/objtype: Check and prevent delete/store on a fixed locals map. 2018-02-07 15:44:29 +11:00
del_deref.py
del_global.py
del_local.py
del_name.py
del_subscr.py
deque1.py py/objdeque: Protect against negative maxlen in deque constructor. 2018-02-21 23:34:17 +11:00
deque2.py tests/basics/deque*: Tests for ucollections.deque. 2018-02-21 22:58:14 +11:00
deque2.py.exp tests/basics/deque*: Tests for ucollections.deque. 2018-02-21 22:58:14 +11:00
dict1.py
dict2.py
dict_clear.py
dict_construct.py
dict_copy.py
dict_del.py
dict_fixed.py py/objdict: Disallow possible modifications to fixed dicts. 2018-02-18 21:51:04 -06:00
dict_fixed.py.exp py/objdict: Disallow possible modifications to fixed dicts. 2018-02-18 21:51:04 -06:00
dict_from_iter.py
dict_fromkeys.py
dict_fromkeys2.py
dict_get.py
dict_intern.py
dict_iterator.py
dict_pop.py
dict_popitem.py
dict_setdefault.py
dict_specialmeth.py
dict_update.py
dict_views.py
equal.py
equal_class.py
errno1.py tests: Add some more tests to improve coverage of py/parse.c. 2017-12-19 16:13:00 +11:00
errno1.py.exp tests: Add some more tests to improve coverage of py/parse.c. 2017-12-19 16:13:00 +11:00
except_match_tuple.py
exception1.py
exception_chain.py
exception_chain.py.exp
exceptpoly.py
exceptpoly2.py
floordivide.py
floordivide_intbig.py
for1.py
for2.py
for3.py
for_break.py
for_else.py
for_range.py
for_return.py
frozenset1.py
frozenset_add.py
frozenset_binop.py
frozenset_copy.py
frozenset_difference.py
frozenset_set.py
fun1.py
fun2.py
fun3.py
fun_annotations.py
fun_calldblstar.py py/runtime: Check that keys in dicts passed as ** args are strings. 2018-03-30 11:13:32 +11:00
fun_calldblstar2.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
fun_calldblstar3.py
fun_callstar.py
fun_callstardblstar.py
fun_defargs.py
fun_defargs2.py
fun_error.py tests: Rewrite some tests so they can run without needing eval/exec. 2018-02-14 16:50:20 +11:00
fun_error2.py tests: Rewrite some tests so they can run without needing eval/exec. 2018-02-14 16:50:20 +11:00
fun_kwargs.py
fun_kwonly.py
fun_kwonlydef.py
fun_kwvarargs.py
fun_largestate.py
fun_name.py tests: Fix few test for proper "skipped" detection with qemu-arm's tinytest. 2017-12-12 23:45:48 +02:00
fun_str.py
fun_varargs.py
gc1.py tests/basics/gc1: Add test which triggers GC threshold. 2018-02-27 22:39:17 +11:00
gen_yield_from.py py/vm: Fix case of handling raised StopIteration within yield from. 2018-02-27 15:39:31 +11:00
gen_yield_from_close.py
gen_yield_from_ducktype.py
gen_yield_from_exc.py
gen_yield_from_executing.py py/objgenerator: Protect against reentering a generator. 2018-05-22 16:54:03 +10:00
gen_yield_from_iter.py
gen_yield_from_send.py
gen_yield_from_stopped.py
gen_yield_from_throw.py
gen_yield_from_throw2.py
gen_yield_from_throw3.py py/runtime: Be sure that non-intercepted thrown object is an exception. 2018-03-30 12:43:38 +11:00
generator1.py
generator2.py
generator_args.py
generator_close.py
generator_closure.py
generator_exc.py
generator_pend_throw.py tests/basics/generator_pend_throw: Add test for just-started generator. 2017-12-19 15:02:34 +11:00
generator_pend_throw.py.exp tests/basics/generator_pend_throw: Add test for just-started generator. 2017-12-19 15:02:34 +11:00
generator_return.py
generator_send.py
getattr.py
getitem.py
globals_del.py
ifcond.py
ifexpr.py
int1.py
int2.py
int_big1.py tests/basics: Add tests for edge cases of nan-box's 47-bit small int. 2018-04-05 00:59:49 +10:00
int_big_add.py tests/basics: Add tests for edge cases of nan-box's 47-bit small int. 2018-04-05 00:59:49 +10:00
int_big_and.py
int_big_and2.py
int_big_and3.py
int_big_cmp.py
int_big_div.py
int_big_error.py
int_big_lshift.py
int_big_mod.py
int_big_mul.py
int_big_or.py
int_big_or2.py
int_big_or3.py
int_big_pow.py
int_big_rshift.py tests/basics: Modify int-big tests to prevent constant folding. 2018-04-04 13:57:22 +10:00
int_big_unary.py
int_big_xor.py tests/basics: Modify int-big tests to prevent constant folding. 2018-04-04 13:57:22 +10:00
int_big_xor2.py
int_big_xor3.py
int_big_zeroone.py
int_bytes.py
int_bytes_intbig.py
int_constfolding.py tests: Add some more tests to improve coverage of py/parse.c. 2017-12-19 16:13:00 +11:00
int_constfolding_intbig.py
int_divmod.py
int_divmod_intbig.py
int_divzero.py
int_intbig.py
int_small.py
io_buffered_writer.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_buffered_writer.py.exp tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_bytesio_cow.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_bytesio_ext.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_bytesio_ext2.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_bytesio_ext2.py.exp tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_iobase.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_stringio1.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_stringio_with.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_write_ext.py tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
io_write_ext.py.exp tests: Move non-filesystem io tests to basics dir with io_ prefix. 2018-06-27 16:55:05 +10:00
is_isnot.py
iter0.py
iter1.py tests/basics/iter1.py: Add more tests for walking a user-defined iter. 2018-03-30 14:23:13 +11:00
iter2.py
iter_of_iter.py
lambda1.py
lambda_defargs.py
lexer.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
list1.py
list_clear.py
list_compare.py
list_copy.py
list_count.py
list_extend.py
list_index.py
list_insert.py
list_mult.py
list_pop.py
list_remove.py
list_reverse.py
list_slice.py
list_slice_3arg.py
list_slice_assign.py
list_slice_assign_grow.py
list_sort.py
list_sum.py
logic_constfolding.py
memoryerror.py tests/basics/memoryerror: Add test for out-of-memory using realloc. 2017-12-20 16:58:27 +11:00
memoryerror.py.exp tests/basics/memoryerror: Add test for out-of-memory using realloc. 2017-12-20 16:58:27 +11:00
memoryview1.py
memoryview2.py
memoryview_gc.py
memoryview_intbig.py
module1.py
module2.py
module2.py.exp
namedtuple1.py tests/basics/namedtuple*: Import ucollections first. 2018-06-27 14:58:14 +10:00
namedtuple_asdict.py tests/basics/namedtuple*: Import ucollections first. 2018-06-27 14:58:14 +10:00
object1.py
object_dict.py
object_new.py
op_error.py tests: Rewrite some tests so they can run without needing eval/exec. 2018-02-14 16:50:20 +11:00
op_error_intbig.py tests: Rewrite some tests so they can run without needing eval/exec. 2018-02-14 16:50:20 +11:00
op_error_memoryview.py tests: Rewrite some tests so they can run without needing eval/exec. 2018-02-14 16:50:20 +11:00
op_precedence.py
ordereddict1.py
ordereddict_eq.py
ordereddict_eq.py.exp
parser.py
python34.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
python34.py.exp
python36.py py/lexer: Add support for underscores in numeric literals. 2018-06-12 12:17:43 +10:00
python36.py.exp py/lexer: Add support for underscores in numeric literals. 2018-06-12 12:17:43 +10:00
return1.py
scope.py
self_type_check.py
seq_unpack.py
set_add.py
set_basic.py
set_binop.py tests/basics: Add more set tests to improve coverage of py/objset.c. 2017-12-19 13:59:54 +11:00
set_clear.py
set_comprehension.py
set_containment.py
set_copy.py
set_difference.py
set_discard.py
set_intersection.py
set_isdisjoint.py
set_isfooset.py tests/basics: Add more set tests to improve coverage of py/objset.c. 2017-12-19 13:59:54 +11:00
set_iter.py
set_iter_of_iter.py
set_pop.py
set_remove.py
set_specialmeth.py
set_symmetric_difference.py
set_type.py
set_union.py
set_unop.py
set_update.py
slice_attrs.py
slice_intbig.py
slots_bool_len.py
special_methods.py
special_methods2.py tests/basics/special_methods2: Enable some additional tests that work. 2018-05-11 17:37:16 +10:00
string1.py
string_center.py
string_compare.py tests/basics/string_compare.py: Add test with string that hashes to 0. 2018-04-05 01:04:38 +10:00
string_count.py
string_cr_conversion.py
string_crlf_conversion.py
string_endswith.py
string_endswith_upy.py
string_endswith_upy.py.exp
string_escape.py
string_find.py py/objstr: In find/rfind, don't crash when end < start. 2018-04-05 16:14:17 +10:00
string_format.py
string_format2.py
string_format_error.py
string_format_modulo.py
string_format_modulo_int.py
string_index.py
string_istest.py
string_join.py
string_large.py
string_mult.py
string_partition.py
string_replace.py
string_repr.py
string_rfind.py py/objstr: In find/rfind, don't crash when end < start. 2018-04-05 16:14:17 +10:00
string_rindex.py
string_rpartition.py
string_rsplit.py
string_slice.py
string_split.py
string_splitlines.py
string_startswith.py
string_startswith_upy.py
string_startswith_upy.py.exp
string_strip.py
string_upperlow.py
struct1.py
struct1_intbig.py
struct2.py
struct_micropython.py
struct_micropython.py.exp
subclass_classmethod.py
subclass_native1.py
subclass_native2_list.py
subclass_native2_tuple.py
subclass_native3.py
subclass_native4.py
subclass_native5.py
subclass_native_buffer.py
subclass_native_call.py tests/basics: Add test for calling a subclass of a native class. 2018-02-24 23:13:42 +11:00
subclass_native_call.py.exp tests/basics: Add test for calling a subclass of a native class. 2018-02-24 23:13:42 +11:00
subclass_native_cmp.py
subclass_native_containment.py
subclass_native_init.py tests/basics: Add test for overriding a native base-class's init method. 2017-12-12 16:47:38 +11:00
subclass_native_iter.py tests/basics: Add test for subclassing an iterable native type. 2018-04-04 15:26:18 +10:00
subclass_native_specmeth.py
syntaxerror.py tests: Automatically skip tests that require eval, exec or frozenset. 2018-02-14 16:46:44 +11:00
sys1.py
sys_getsizeof.py tests/basics: Add tests to improve coverage of py/objdeque.c. 2018-02-21 23:19:06 +11:00
true_value.py
try1.py
try2.py
try3.py
try4.py
try_as_var.py
try_continue.py
try_error.py
try_finally1.py
try_finally2.py
try_finally_loops.py
try_finally_return.py
try_finally_return2.py
try_reraise.py
try_reraise2.py
try_return.py tests/basics: Add test for use of return within try-except. 2018-04-04 01:43:16 +10:00
tuple1.py
tuple_compare.py
tuple_count.py
tuple_index.py
tuple_mult.py
types1.py
types2.py
unary_op.py
unboundlocal.py
unpack1.py
while1.py
while_cond.py
while_nest_exc.py
with1.py
with_break.py
with_continue.py
with_return.py