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.
pull/3730/merge
Mike Wadsten 2018-04-30 20:59:23 -05:00 zatwierdzone przez Damien George
rodzic 28c9824c51
commit 9f1eafc380
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -10,4 +10,4 @@ except Exception as e:
# CPython throws ValueError, but MicroPython has consistent stream
# interface, so BytesIO raises the same error as a real file, which
# is OSError(EINVAL).
print(repr(e))
print(type(e), e.args[0] > 0)

Wyświetl plik

@ -1 +1 @@
OSError(22,)
<class 'OSError'> True