summaryrefslogtreecommitdiff
path: root/tests/misc/print_exception.py
AgeCommit message (Collapse)Author
2025-06-05tests/run-tests.py: Automatically skip tests that are too large.Damien George
Some tests are just too big for targets that don't have much heap memory, eg `tests/extmod/vfs_rom.py`. Other tests are too large because the target doesn't have enough IRAM for native code, eg esp8266 running `tests/micropython/viper_args.py`. Previously, such tests were explicitly skipped on targets known to have little memory, eg esp8266. But this doesn't scale to multiple targets, nor to more and more tests which are too large. This commit addresses that by adding logic to the test runner so it can automatically skip tests when they don't fit in the target's memory. It does this by prepending a `print('START TEST')` to every test, and if a `MemoryError` occurs before that line is printed then the test was too big. This works for standard tests, tests that go via .mpy files, and tests that run in native emitter mode via .mpy files. For tests that are too big, it prints `lrge <test name>` on the output, and at the end prints them on a separate line of skipped tests so they can be distinguished. They are also distinguished in the `_result.json` file as a skipped test with reason "too large". Signed-off-by: Damien George <damien@micropython.org>
2023-06-08tests: Replace umodule with module everywhere.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-02top: Update Python formatting to black "2023 stable style".Jim Mussared
See https://black.readthedocs.io/en/stable/the_black_code_style/index.html Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-09-04all: Rename "sys" module to "usys".stijn
This is consistent with the other 'micro' modules and allows implementing additional features in Python via e.g. micropython-lib's sys. Note this is a breaking change (not backwards compatible) for ports which do not enable weak links, as "import sys" must now be replaced with "import usys".
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.
2019-08-28py/vm: Don't add traceback info for exceptions that are re-raised.Damien George
With this patch exceptions that are re-raised have improved tracebacks (less confusing, match CPython), and it makes re-raise slightly more efficient (in time and RAM) because they no longer need to add a traceback. Also general VM performance is not measurably affected. Partially fixes issue #2928.
2019-08-28py/vm: Don't add traceback info for exc's propagated through a finally.Damien George
With this patch exception tracebacks that go through a finally are improved (less confusing, match CPython), and it makes finally's slightly more efficient (in time and RAM) because they no longer need to add a traceback. Partially fixes issue #2928.
2018-09-20py: Shorten error messages by using contractions and some rewording.Damien George
2018-08-04tests: Make tests work on targets without float support.Ayke van Laethem
2018-06-20tests: Add tests using "file" argument in print and sys.print_exception.Damien George
2017-06-10tests: Convert remaining "sys.exit()" to "raise SystemExit".Paul Sokolovsky
2017-03-11tests/misc/: Make few tests skippable.Paul Sokolovsky
2017-02-10tests/misc: Add test for line number printing with large bytecode chunk.Damien George
2016-05-02tests: Make "io" modules fixes for CPython compatibility.Paul Sokolovsky
Previously, "import _io" worked on both CPython and MicroPython (essentially by a chance on CPython, as there's not guarantee that its contents will stay the same across versions), but as the module was renamed to uio, need to use more robust import sequence for compatibility.
2016-05-02tests: Update for _io/_collections module having been renamed.Paul Sokolovsky
2016-03-07tests/print_exception: Use exception which prints the same regardless of config.Paul Sokolovsky
NameError may either include offending name or not. Unfortunately, this change makes test float-dependent. And using integer division leads to different error message than CPython.
2015-10-02tests: Allow tests to pass against CPython 3.5.Damien George
All breaking changes going from 3.4 to 3.5 are contained in basics/python34.py.
2015-02-27py: Fix adding of traceback so that it appends to existing info.Damien George
This makes exception traceback info self contained (ie doesn't rely on list object, which was a bit of a hack), reduces code size, and reduces RAM footprint of exception by eliminating the list object. Addresses part of issue #1126.
2014-12-18tests: Get misc/print_exception and pyb/spi working on pyboard.Damien George
2014-12-11tests: Fix print_exception test and re-enable it on Travis CI.Damien George
Issue was with uPy: on local machine with micropython-lib installed, io module is available. Not the case on Travis CI, where only _io module is available in uPy.
2014-12-10tests: Fix print_exception.py to work on Travis CI.Damien George
2014-12-10tests: Add test for print_exception() function.Paul Sokolovsky