summaryrefslogtreecommitdiff
path: root/tests/extmod/btree_error.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/btree_error.py')
-rw-r--r--tests/extmod/btree_error.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/extmod/btree_error.py b/tests/extmod/btree_error.py
index b64769e88..2dd0d137a 100644
--- a/tests/extmod/btree_error.py
+++ b/tests/extmod/btree_error.py
@@ -1,15 +1,15 @@
# Test that errno's propagate correctly through btree module.
try:
- import btree, uio, uerrno
+ import btree, io, errno
- uio.IOBase
+ io.IOBase
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
-class Device(uio.IOBase):
+class Device(io.IOBase):
def __init__(self, read_ret=0, ioctl_ret=0):
self.read_ret = read_ret
self.ioctl_ret = ioctl_ret
@@ -25,18 +25,24 @@ class Device(uio.IOBase):
# Invalid pagesize; errno comes from btree library
try:
+ import btree, io, errno
+
db = btree.open(Device(), pagesize=511)
except OSError as er:
- print("OSError", er.errno == uerrno.EINVAL)
+ print("OSError", er.errno == errno.EINVAL)
# Valid pagesize, device returns error on read; errno comes from Device.readinto
try:
+ import btree, io, errno
+
db = btree.open(Device(-1000), pagesize=512)
except OSError as er:
print(repr(er))
# Valid pagesize, device returns error on seek; errno comes from Device.ioctl
try:
+ import btree, io, errno
+
db = btree.open(Device(0, -1001), pagesize=512)
except OSError as er:
print(repr(er))