aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-04-13tests/run-tests: Make diff tool user configurable.stijn
2020-04-09py/parse: Remove unnecessary check in const folding for ** operator.Damien George
In this part of the code there is no way to get the ** operator, so no need to check for it. This commit also adds tests for this, and other related, invalid const operations.
2020-04-09tests/extmod: Update littlefs test output to match new library version.Damien George
The amount of free space on the VfsLfs2 filesystem after creating a large file is reduced by 2 blocks in this test.
2020-04-07extmod/modbluetooth: Provide FLAG_WRITE_NO_RESPONSE for characteristics.Damien George
This flag is supported and needs to be set if characteristics are write- without-response.
2020-04-05py/objexcept: Allow compression of exception message text.Jim Mussared
The decompression of error-strings is only done if the string is accessed via printing or via er.args. Tests are added for this feature to ensure the decompression works.
2020-04-04docs,tests: Add docs and test for uasyncio custom exc handler methods.Damien George
2020-04-02extmod/uasyncio: Implement Loop.stop() to stop the event loop.Damien George
2020-03-30tests/run-tests: Add commands to print and clean *.exp,out files.David Lechner
This adds a couple of commands to the run-tests script to print the diffs of failed tests and also to clean up the .exp and .out files after failed tests. (And a spelling error is fixed while we are touching nearby code.) Travis is also updated to use these new commands, including using it for more builds.
2020-03-30tests/float: Add new lexer test to test parsing of float without prefix.David Lechner
Since automatically formatting tests with black, we have lost one line of code coverage. This adds an explicit test to ensure we are testing the case that is no longer covered implicitly.
2020-03-30tests: Format all Python code with black, except tests in basics subdir.David Lechner
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
2020-03-30tests/micropython/heapalloc_fail_set.py: Remove extra trailing comma.David Lechner
Unlike tuples, sets do not need trailing comma when there is only one item.
2020-03-28tests/basics/dict_pop.py: Remove extra comma in call and fix grammar.David Lechner
2020-03-26tests/net_inet: Add uasyncio internet tests.Damien George
2020-03-26tests/multi_net: Add uasyncio test for TCP server and client.Damien George
Includes a test where the (non uasyncio) client does a RST on the connection, as a simple TCP server/client test where both sides are using uasyncio, and a test for TCP stream close then write.
2020-03-26tests: Make default MICROPYPATH include extmod to find uasyncio.Damien George
2020-03-26tests/run-tests: Skip uasyncio if no async, and skip one test on native.Damien George
2020-03-26tests/extmod: Add uasyncio tests.Damien George
All .exp files are included because they require CPython 3.8 which may not always be available.
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