Skip to content

Commit 9f1eafc

Browse files
mikewadstendpgeorge
authored andcommitted
tests/io/bytesio_ext2: Remove dependency on specific EINVAL value
If MICROPY_USE_INTERNAL_ERRNO is disabled, MP_EINVAL is not guaranteed to have the value 22, so we cannot depend on OSError(22,). Instead, to support any given port's errno values, without relying on uerrno, we just check that the args[0] is positive.
1 parent 28c9824 commit 9f1eafc

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

tests/io/bytesio_ext2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# CPython throws ValueError, but MicroPython has consistent stream
1111
# interface, so BytesIO raises the same error as a real file, which
1212
# is OSError(EINVAL).
13-
print(repr(e))
13+
print(type(e), e.args[0] > 0)

tests/io/bytesio_ext2.py.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
OSError(22,)
1+
<class 'OSError'> True

0 commit comments

Comments
 (0)