Commit Graph

2190 Commits

Author SHA1 Message Date
Jeff Epler
cc16bd3d53
do not chain exceptions to themselves
cpython actually makes sure the newly chained exception doesn't create
a cycle (even indirectly); see _PyErr_SetObject use of "Floyd's cycle
detection algo". We'll go for the simpler solution of just checking
one level deep until it's clear we need to do more.

Closes: #7414
2023-01-04 08:40:20 -06:00
Jeff Epler
2c46e785f6
update test results 2022-12-28 12:38:07 -06:00
Jeff Epler
83bbfd1815
Allow the tests to directly call the non-heap using _int and _str variants
.. of getenv. These can have their own special bugs.
2022-12-28 12:36:58 -06:00
Jeff Epler
edcb832661
These need to be double-blackslashed 2022-12-28 12:35:48 -06:00
Jeff Epler
337b1da143
Explicitly test \n and \r\n files
\r\n files must be working due to micropython's built in handling of
text-mode files, I didn't implement it.

\r-only (old mac text-mode files) are explicitly not supported by
the toml format.
2022-12-26 10:53:58 -06:00
Jeff Epler
f6b69cf5e3
Allow settings.toml to end without a newline 2022-12-26 10:53:58 -06:00
Jeff Epler
6426ddb73b
Rename test and add some additional cases
While working on adding 0o and 0b literals (which aren't added yet and
may not be) I realized that my approach would likely cause a problem
for the value "0"
2022-12-12 08:22:54 -06:00
Jeff Epler
dd6dd5df21
rework the getenv test again
* use a virtual fat filesystem during the test
 * this makes the file I/O part more closely patch runtime which is nice
 * side-steps the need to add a special function for testing
   * but test still can't be run on a device, because the vfs calls
     are incompatible, and you intentionally can't remount "/" anyway
 * and side-steps problems with storing 'bad' toml files
2022-12-10 12:58:08 -06:00
Jeff Epler
3ab71d7448
Rename test function, make 'bad' files binary & add another test 2022-12-09 15:23:56 -06:00
Jeff Epler
6dca9db225
Rename test function & fix a bug with default value handling 2022-12-09 14:35:50 -06:00
Jeff Epler
f30d3ba02e
update expected result 2022-12-08 15:39:19 -06:00
Jeff Epler
3459fe322b
Withdraw the _environ module
This existed solely for testing, so expose it a different way during
the unix coverage build

Also turn off os.getenv support on samd21.
2022-12-08 15:33:10 -06:00
Jeff Epler
ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -06:00
Jeff Epler
b83c42e41a
Implement the chain= argument of traceback.print_exception 2022-12-02 10:50:31 -06:00
Jeff Epler
dd443bacb8
Chain exceptions while unwinding 2022-11-13 19:53:23 -06:00
Jeff Epler
b6f86e1e73
Recursively print chained exceptions 2022-11-13 19:53:21 -06:00
Jeff Epler
f3169246ba
Implement chained exceptions
This adds the __cause__, __context__ and __suppress_context__
members to exception objects and makes e.g., `raise exc from cause`
set them in the same way as standard Python.
2022-11-13 19:52:50 -06:00
Jeff Epler
05252c87f4
Don't crash when assigning attributes of the GeneratorExit const singleton 2022-10-22 11:37:34 -05:00
Jim Mussared
55169e0b4d
extmod/uasyncio/task.py: Fix crash when non-awaited task is awaited.
A task that has been sent to the loop's exception handler due to being
re-scheduled twice will then subsequently cause a `raise None` if it is
subsequently awaited. In the C version of task.py, this causes a segfault.

This makes the await succeed (via raising StopIteration instead).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-10-15 14:58:07 -05:00
Jeff Epler
4f190c9228
Handle tests that just won't stop 2022-10-14 16:40:10 -05:00
Jeff Epler
798f6ec71f
Switch tests to run on Adafruit_CircuitPython_asyncio (fails)
This also depends on https://github.com/adafruit/Adafruit_CircuitPython_Ticks/pull/8
otherwise adafruit_ticks is unimportable and the tests are just skipped.

Several of the tests fail, and one runs forever instead of terminating.

We should fix our asyncio until the tests patch, then incorporate this
change.
2022-10-14 14:44:52 -05:00
Jeff Epler
55519670a8
Fix parsing long dotenv values
Values that exceeded the stack buffer of 64 bytes were incorrectly
handled.

A new test is added.
2022-10-13 16:41:30 -05:00
Jeff Epler
febc7a8514
format_traceback: Return list, as documented, and compatible with CPython 2022-10-13 09:38:43 -05:00
Jeff Epler
9ecb905061
Test new-style exception printing 2022-10-13 09:38:43 -05:00
Jeff Epler
c6bbb0e4f6
test format_exception too 2022-10-13 09:38:41 -05:00
Dan Halbert
6ee45dde57 f_rename return value; add a test for rename dir inside itself 2022-10-12 16:52:22 -04:00
Dan Halbert
6dcbb61081 fix test that used MpyError 2022-10-09 20:27:39 -04:00
Jeff Epler
27e6623657
Add unicode support to dotenv
Newly passing tests:
```
aa🐍bb=key with emoji
value_with_emoji=aa🐍bb
```
2022-10-05 18:18:07 -05:00
Dan Halbert
91079279da Allow spaces before = in dotenv 2022-10-05 15:50:53 -04:00
Jeff Epler
718b8e706e
disable test e15 for now 2022-10-04 10:54:22 -05:00
Jeff Epler
52bca95208
Refactor dotenv module so that it can be tested on host
.. it needs to operate on a FILE* rather than FIL depending on
the build.

Note that this is comparing output to expected, not to cpython dotenv
package. Because run-tests.py starts the CPython interpreter with the
'-S' (skip site initialization) flag, pip-installed packages are
not available for import inside a test file. Instead, the exp
file is generated manually:
```
circuitpython/tests$ python3 circuitpython/dotenv_test.py > circuitpython/dotenv_test.py.exp
```

Unfortunately, the test fails on test e15:
```diff
FAILURE /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py
--- /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.exp	2022-10-04 09:48:16.307703128 -0500
+++ /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.out	2022-10-04 09:48:16.307703128 -0500
@@ -14,7 +14,7 @@
 line
 e13 e13value
 e14 None
-e15 e15value
+e15 None
 e16 #
 e17 def
 e18 #has a hash
```
2022-10-04 09:51:27 -05:00
Dan Halbert
6dc03ae3ce fix some dotenv parsing 2022-10-03 21:56:11 -04:00
Scott Shawcroft
7717ab8e13
Merge pull request #6754 from jepler/check-read-utf8
When reading data from a file into a str, check if it's utf-8
2022-08-15 13:48:43 -07:00
Jeff Epler
606c75ab62
test must read data in binary mode 2022-08-12 08:34:33 -05:00
Dan Ellis
9b5e00fcc5 py/formatfloat: Format all whole-number floats exactly.
Formerly, py/formatfloat would print whole numbers inaccurately with
nonzero digits beyond the decimal place.  This resulted from its strategy
of successive scaling of the argument by 0.1 which cannot be exactly
represented in floating point.  The change in this commit avoids scaling
until the value is smaller than 1, so all whole numbers print with zero
fractional part.

Fixes issue #4212.

Signed-off-by: Dan Ellis dan.ellis@gmail.com
2022-08-09 13:43:47 -04:00
Jeff Epler
8d816db108
update expected results of help(modules) 2022-07-07 13:42:03 -05:00
Mark
8ed7b114cd
Merge branch 'main' into uzlib-module 2022-04-03 11:48:37 -05:00
gamblor21
0d3f45bef8 Remove move DecompIO files 2022-03-27 16:18:56 -05:00
foamyguy
255fdf8eba remove unused import 2022-03-19 11:36:23 -05:00
foamyguy
5db7e33237 color index test script for vectorio shapes. 2022-03-19 11:33:55 -05:00
Scott Shawcroft
00dcf6bd03
Tweaks from review 2022-03-11 10:51:50 -08:00
Scott Shawcroft
96f5eec2ee
Add Teensy 4.1 power pin and fix SWD for DEBUG=1 2022-03-08 17:17:07 -08:00
Scott Shawcroft
83593a1558
Start of USB host API
This allows you to list and explore connected USB devices. It
only stubs out the methods to communicate to endpoints. That will
come in a follow up once TinyUSB has it. (It's in progress.)

Related to #5986
2022-03-07 18:07:25 -08:00
Dan Halbert
d70f149390 change module list in extra_coverage test results 2022-02-24 22:44:13 -05:00
gamblor21
ce4a0806b3 Added test coverage 2022-02-21 10:24:13 -06:00
Jeff Epler
a040b6962f
update module list in extra coverage test 2022-02-19 09:38:56 -06:00
Jeff Epler
34d71097ff
Fix import ulab.foo 2022-02-19 09:32:51 -06:00
Jeff Epler
57f46a177c
remove debug print 2022-02-16 14:28:56 -06:00
Jeff Epler
4c9d14b73f Merge remote-tracking branch 'origin/main' into merge-1.18 2022-02-16 11:43:53 -06:00
Jeff Epler
dd7b48f2b3 blacken 2022-02-16 10:31:34 -06:00