Skip to content

Commit 0d5f468

Browse files
committed
tests/basics: Skip tests of io module individually using SKIP.
Instead of using a feature check. This is more consistent with how other optional modules are skipped. Signed-off-by: Damien George <damien@micropython.org>
1 parent 5357c97 commit 0d5f468

12 files changed

+47
-28
lines changed

tests/basics/io_buffered_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import io
2-
31
try:
2+
import io
3+
44
io.BytesIO
55
io.BufferedWriter
6-
except AttributeError:
6+
except (AttributeError, ImportError):
77
print('SKIP')
88
raise SystemExit
99

tests/basics/io_bytesio_cow.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Make sure that write operations on io.BytesIO don't
22
# change original object it was constructed from.
3-
import io
3+
4+
try:
5+
import io
6+
except ImportError:
7+
print("SKIP")
8+
raise SystemExit
9+
410
b = b"foobar"
511

612
a = io.BytesIO(b)

tests/basics/io_bytesio_ext.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Extended stream operations on io.BytesIO
2-
import io
2+
3+
try:
4+
import io
5+
except ImportError:
6+
print("SKIP")
7+
raise SystemExit
8+
39
a = io.BytesIO(b"foobar")
410
a.seek(10)
511
print(a.read(10))

tests/basics/io_bytesio_ext2.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import io
1+
try:
2+
import io
3+
except ImportError:
4+
print("SKIP")
5+
raise SystemExit
6+
27
a = io.BytesIO(b"foobar")
38
try:
49
a.seek(-10)

tests/basics/io_iobase.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import io
21
try:
2+
import io
3+
34
io.IOBase
4-
except AttributeError:
5-
print('SKIP')
5+
except (AttributeError, ImportError):
6+
print("SKIP")
67
raise SystemExit
78

89

tests/basics/io_stringio1.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import io
1+
try:
2+
import io
3+
except ImportError:
4+
print("SKIP")
5+
raise SystemExit
6+
27
a = io.StringIO()
38
print('io.StringIO' in repr(a))
49
print(a.getvalue())

tests/basics/io_stringio_base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Checks that an instance type inheriting from a native base that uses
22
# MP_TYPE_FLAG_ITER_IS_STREAM will still have a getiter.
33

4-
import io
4+
try:
5+
import io
6+
except ImportError:
7+
print("SKIP")
8+
raise SystemExit
59

610
a = io.StringIO()
711
a.write("hello\nworld\nmicro\npython\n")

tests/basics/io_stringio_with.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import io
1+
try:
2+
import io
3+
except ImportError:
4+
print("SKIP")
5+
raise SystemExit
6+
27
# test __enter__/__exit__
38
with io.StringIO() as b:
49
b.write("foo")

tests/basics/io_write_ext.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# This tests extended (MicroPython-specific) form of write:
22
# write(buf, len) and write(buf, offset, len)
3-
import io
43

54
try:
5+
import io
6+
67
io.BytesIO
7-
except AttributeError:
8+
except (AttributeError, ImportError):
89
print('SKIP')
910
raise SystemExit
1011

tests/feature_check/io_module.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)