From 9f1eafc38092213bf59cd5dfdd803249077729c3 Mon Sep 17 00:00:00 2001 From: Mike Wadsten Date: Mon, 30 Apr 2018 20:59:23 -0500 Subject: [PATCH] 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. --- tests/io/bytesio_ext2.py | 2 +- tests/io/bytesio_ext2.py.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/io/bytesio_ext2.py b/tests/io/bytesio_ext2.py index c07ad900c9..8f624fd58c 100644 --- a/tests/io/bytesio_ext2.py +++ b/tests/io/bytesio_ext2.py @@ -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) diff --git a/tests/io/bytesio_ext2.py.exp b/tests/io/bytesio_ext2.py.exp index b52e4978aa..724aaf63a2 100644 --- a/tests/io/bytesio_ext2.py.exp +++ b/tests/io/bytesio_ext2.py.exp @@ -1 +1 @@ -OSError(22,) + True