summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-03-18tests/run-multitests.py: Print test summary and do exit(1) on failure.Damien George
2020-03-18extmod/modlwip: Properly handle non-blocking and timeout on UDP recv.Damien George
Fixes UDP non-blocking recv so it returns EAGAIN instead of ETIMEDOUT. Timeout waiting for incoming data is also improved by replacing 100ms delay with poll_sockets(), as is done in other parts of this module. Fixes issue #5759.
2020-03-18extmod/modlwip: Fix polling of UDP socket so it doesn't return HUP.Damien George
STATE_NEW will return HUP when polled so put active UDP sockets into a new state which is different to STATE_NEW. Fixes issue #5758.
2020-03-11tests/run-tests: Consider all tests as native when emit=native is used.Damien George
So that they are skipped when running on a target that doesn't support the native emitter, eg a nanbox build.
2020-03-11py/modmicropython: Add heap_locked function to test state of heap.Andrew Leech
This commit adds micropython.heap_locked() which returns the current lock-depth of the heap, and can be used by Python code to check if the heap is locked or not. This new function is configured via MICROPY_PY_MICROPYTHON_HEAP_LOCKED and is disabled by default. This commit also changes the return value of micropython.heap_unlock() so it returns the current lock-depth as well.
2020-03-11py/objstringio: Expose tell() on StringIO and BytesIO objects.Andrew Leech
To match file objects. Fixes issue #5581.
2020-03-11extmod/modbluetooth: Change scan result's "connectable" to "adv_type".Damien George
This commit changes the BLE _IRQ_SCAN_RESULT data from: addr_type, addr, connectable, rssi, adv_data to: addr_type, addr, adv_type, rssi, adv_data This allows _IRQ_SCAN_RESULT to handle all scan result types (not just connectable and non-connectable passive scans), and to distinguish between them using adv_type which is an integer taking values 0x00-0x04 per the BT specification. This is a breaking change to the API, albeit a very minor one: the existing connectable value was a boolean and True now becomes 0x00, False becomes 0x02. Documentation is updated and a test added. Fixes #5738.
2020-03-10tests/multi_bluetooth: Add initial tests for bluetooth BLE.Damien George
2020-03-10tests/multi_net: Add initial set of multi-instance tests for network.Damien George
2020-03-10tests/run-multitests.py: Add new test runner for multiple Py instances.Damien George
This commit adds a test runner and initial test scripts which run multiple Python/MicroPython instances (eg executables, target boards) in parallel. This is useful for testing, eg, network and Bluetooth functionality. Each test file has a set of functions called instanceX(), where X ranges from 0 up to the maximum number of instances that are needed, N-1. Then run-multitests.py will execute this script on N separate instances (eg micropython executables, or attached boards via pyboard.py) at the same time, synchronising their start in the right order, possibly passing IP address (or other address like bluetooth MAC) from the "server" instance to the "client" instances so they can connect to each other. It then runs them to completion, collects the output, and then tests against what CPython gives (or what's in a provided .py.exp file). The tests will be run using the standard unix executable for all instances by default, eg: $ ./run-multitests.py multi_net/*.py Or they can be run with a board and unix executable via: $ ./run-multitests.py --instance pyb:/dev/ttyACM0 --instance exec:micropython multi_net/*.py
2020-02-28py/builtinevex: Support passing in a bytearray/buffer to eval/exec.Damien George
CPython allows this and it's a simple generalisation of the existing code which just supported str/bytes. Fixes issue #5704.
2020-02-21tests/basics/array1.py: Add equality testing for array.Jim Mussared
2020-02-21py/objarray: Turn on MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE for memoryview.Jim Mussared
And add corresponding tests. Fixes #5674 (comparison of memoryview against bytes).
2020-02-21extmod/modframebuf: Allow blit source to be a subclass of FrameBuffer.Jim Mussared
2020-02-20tests/basics: Add test for tuple compare with class derived from tuple.Damien George
Only the "==" operator was tested by the test suite in for such arguments. Other comparison operators like "<" take a different path in the code so need to be tested separately.
2020-02-11tests/basics: Add test for equality between tuple and namedtuple.Damien George
2020-02-11tests/basics: Add tests for equality between bool and int/float/complex.Damien George
False/True should be implicitly converted to 0/1 when compared with numeric types.
2020-02-11tests/run-tests: Auto-skip extmod/ticks_diff, extmod/time_ms_us tests.Yonatan Goldschmidt
2020-02-07tests/unix: Add coverage tests for kbd-intr and scheduler.Damien George
2020-02-06tests/basics: Move test for "return" outside function to own file.Petr Viktorin
Because its behaviour is conditional on MICROPY_CPYTHON_COMPAT.
2020-02-04tests: Move CPy diff test to real test now that subclass equality works.Damien George
Testing for equality of subclassed strings now works, thanks to commit 3aab54bf434e7f025a91ea05052f1bac439fad8c
2020-02-04tests/cpydiff: Add os module environ differences.David Lechner
2020-02-04tests/cmdline: Add test for MICROPYINSPECT environment variable.David Lechner
When this variable is set to non-empty string it triggers the REPL after a command/module/file finishes running. The Python file without the file extension is because the cmdline: parser in run-test splits on spaces, so we can't use the -c option since `import os` can't be written without a space.
2020-02-04tests/cmdline/repl_inspect: Add new test for -i option.David Lechner
This adds a new test to verify that the inspect (-i) command line option works.
2020-01-30tests/basics: Expand test cases for equality of subclasses.Nicko van Someren
2020-01-30py: Support non-boolean results for equality and inequality tests.Nicko van Someren
This commit implements a more complete replication of CPython's behaviour for equality and inequality testing of objects. This addresses the issues discussed in #5382 and a few other inconsistencies. Improvements over the old code include: - Support for returning non-boolean results from comparisons (as used by numpy and others). - Support for non-reflexive equality tests. - Preferential use of __ne__ methods and MP_BINARY_OP_NOT_EQUAL binary operators for inequality tests, when available. - Fallback to op2 == op1 or op2 != op1 when op1 does not implement the (in)equality operators. The scheme here makes use of a new flag, MP_TYPE_FLAG_NEEDS_FULL_EQ_TEST, in the flags word of mp_obj_type_t to indicate if various shortcuts can or cannot be used when performing equality and inequality tests. Currently four built-in classes have the flag set: float and complex are non-reflexive (since nan != nan) while bytearray and frozenszet instances can equal other builtin class instances (bytes and set respectively). The flag is also set for any new class defined by the user. This commit also includes a more comprehensive set of tests for the behaviour of (in)equality operators implemented in special methods.
2020-01-27tests: Add tests for generator throw and yield-from with exc handlers.Jim Mussared
This commit adds a generator test for throwing into a nested exception, and one when using yield-from with a pending exception cleanup. Both these tests currently fail on the native emitter, and are simplified versions of native test failures from uasyncio in #5332.
2020-01-24tests: Add boolean-as-integer formatting tests for fixed regression.Yonatan Goldschmidt
As suggested by @dpgeorge in #5538.
2020-01-24tests/unix: Add coverage tests for mp_obj_is_type() and variants.Yonatan Goldschmidt
2020-01-23tests/unix: Add coverage test for mp_obj_new_exception_args.Damien George
Because it's no longer called anywhere in the code.
2020-01-22tests/unix: Add coverage tests for pairheap data structure.Damien George
2020-01-22tests/extmod: Add basic machine.Timer test.Damien George
2020-01-22tests: Make run-tests help and README be more descriptive of behaviour.Thorsten von Eicken
2020-01-14tests/unix: Add coverage test for new mp_obj_int_get_uint_checked func.Damien George
2020-01-12lib/mp-readline: Add word-based move/delete EMACS key sequences.Yonatan Goldschmidt
This commit adds backward-word, backward-kill-word, forward-word, forward-kill-word sequences for the REPL, with bindings to Alt+F, Alt+B, Alt+D and Alt+Backspace respectively. It is disabled by default and can be enabled via MICROPY_REPL_EMACS_WORDS_MOVE. Further enabling MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE adds extra bindings for these new sequences: Ctrl+Right, Ctrl+Left and Ctrl+W. The features are enabled on unix micropython-coverage and micropython-dev.
2020-01-12unix: Rename unix binaries to micropython-variant (not _variant).Jim Mussared
For consistency with mpy-cross, and other unix tools in general.
2020-01-06tests/unix: Make unix time test pass on more platforms.stijn
As the mktime documentation for CPython states: "The earliest date for which it can generate a time is platform-dependent". In particular on Windows this depends on the timezone so e.g. for UTC+2 the earliest is 2 hours past midnight January 1970. So change the reference to the earliest possible, for UTC+14.
2020-01-06tests/cpydiff: Add CPy diff-test for using dict.keys() as a set.Damien George
See issue #5493.
2020-01-06tests/run-tests: Handle 'CRASH' return by float.py feature test.David Lechner
It is possile for `run_feature_check(pyb, args, base_path, 'float.py')` to return `b'CRASH'`. This causes an unhandled exception in `int()`. This commit fixes the problem by first testing for `b'CRASH'` before trying to convert the return value to an integer.
2019-12-28py/objslice: Add support for indices() method on slice objects.Nicko van Someren
Instances of the slice class are passed to __getitem__() on objects when the user indexes them with a slice. In practice the majority of the time (other than passing it on untouched) is to work out what the slice means in the context of an array dimension of a particular length. Since Python 2.3 there has been a method on the slice class, indices(), that takes a dimension length and returns the real start, stop and step, accounting for missing or negative values in the slice spec. This commit implements such a indices() method on the slice class. It is configurable at compile-time via MICROPY_PY_BUILTINS_SLICE_INDICES, disabled by default, enabled on unix, stm32 and esp32 ports. This commit also adds new tests for slice indices and for slicing unicode strings.
2019-12-28unix/modtime: Add utime.mktime function, to complement utime.localtime.Andrew Leech
This also adds it to the windows port.
2019-12-27py/objsingleton: Use mp_generic_unary_op for singleton objects.Damien George
So these types more closely match NoneType, eg they can be hashed, like in CPython.
2019-12-27tests/micropython: Add test for yield-from while heap is locked.Damien George
2019-12-27tests/extmod: Split out VfsFat finaliser tests to separate test file.Damien George
It tests independent functionality and may need to be skipped for a given port.
2019-12-27tests/run-tests: Add "--mpy-cross-flags" arg to specify mpy-cross flags.Damien George
2019-12-21py/objobject: Add object.__delattr__ function.Yonatan Goldschmidt
Similar to object.__setattr__.
2019-12-21py/objobject: Add object.__setattr__ function.Yonatan Goldschmidt
Allows assigning attributes on class instances that implement their own __setattr__. Both object.__setattr__ and super(A, b).__setattr__ will work with this commit.
2019-12-20tests/pyb: Adjust UART and Timer tests to work on PYBD_SF6.Damien George
2019-12-13tests/pyb: Refactor pyboard tests to work on PYBv1, PYBLITEv1 and PYBD.Damien George
2019-12-13tests/extmod/vfs_lfs_error: Use small ints in seek error test.Damien George
So accessing the seek offset (at the C level) doesn't cause an OverflowError on 32-bit targets.