mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
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>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import io
|
||||
|
||||
try:
|
||||
import io
|
||||
|
||||
io.BytesIO
|
||||
io.BufferedWriter
|
||||
except AttributeError:
|
||||
except (AttributeError, ImportError):
|
||||
print('SKIP')
|
||||
raise SystemExit
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
# Make sure that write operations on io.BytesIO don't
|
||||
# change original object it was constructed from.
|
||||
import io
|
||||
|
||||
try:
|
||||
import io
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
b = b"foobar"
|
||||
|
||||
a = io.BytesIO(b)
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Extended stream operations on io.BytesIO
|
||||
import io
|
||||
|
||||
try:
|
||||
import io
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
a = io.BytesIO(b"foobar")
|
||||
a.seek(10)
|
||||
print(a.read(10))
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import io
|
||||
try:
|
||||
import io
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
a = io.BytesIO(b"foobar")
|
||||
try:
|
||||
a.seek(-10)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import io
|
||||
try:
|
||||
import io
|
||||
|
||||
io.IOBase
|
||||
except AttributeError:
|
||||
print('SKIP')
|
||||
except (AttributeError, ImportError):
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import io
|
||||
try:
|
||||
import io
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
a = io.StringIO()
|
||||
print('io.StringIO' in repr(a))
|
||||
print(a.getvalue())
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# Checks that an instance type inheriting from a native base that uses
|
||||
# MP_TYPE_FLAG_ITER_IS_STREAM will still have a getiter.
|
||||
|
||||
import io
|
||||
try:
|
||||
import io
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
a = io.StringIO()
|
||||
a.write("hello\nworld\nmicro\npython\n")
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import io
|
||||
try:
|
||||
import io
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
# test __enter__/__exit__
|
||||
with io.StringIO() as b:
|
||||
b.write("foo")
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# This tests extended (MicroPython-specific) form of write:
|
||||
# write(buf, len) and write(buf, offset, len)
|
||||
import io
|
||||
|
||||
try:
|
||||
import io
|
||||
|
||||
io.BytesIO
|
||||
except AttributeError:
|
||||
except (AttributeError, ImportError):
|
||||
print('SKIP')
|
||||
raise SystemExit
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
try:
|
||||
import io
|
||||
|
||||
print("io")
|
||||
except ImportError:
|
||||
print("no")
|
||||
@@ -695,7 +695,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
|
||||
skip_async = False
|
||||
skip_const = False
|
||||
skip_revops = False
|
||||
skip_io_module = False
|
||||
skip_fstring = False
|
||||
skip_endian = False
|
||||
skip_inlineasm = False
|
||||
@@ -752,11 +751,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
|
||||
if output == b"TypeError\n":
|
||||
skip_revops = True
|
||||
|
||||
# Check if io module exists, and skip such tests if it doesn't
|
||||
output = run_feature_check(pyb, args, "io_module.py")
|
||||
if output != b"io\n":
|
||||
skip_io_module = True
|
||||
|
||||
# Check if fstring feature is enabled, and skip such tests if it doesn't
|
||||
output = run_feature_check(pyb, args, "fstring.py")
|
||||
if output != b"a=1\n":
|
||||
@@ -925,7 +919,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
|
||||
is_slice = test_name.find("slice") != -1 or test_name in misc_slice_tests
|
||||
is_async = test_name.startswith(("async_", "asyncio_")) or test_name.endswith("_async")
|
||||
is_const = test_name.startswith("const")
|
||||
is_io_module = test_name.startswith("io_")
|
||||
is_fstring = test_name.startswith("string_fstring")
|
||||
is_inlineasm = test_name.startswith("asm")
|
||||
|
||||
@@ -940,7 +933,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
|
||||
skip_it |= skip_async and is_async
|
||||
skip_it |= skip_const and is_const
|
||||
skip_it |= skip_revops and "reverse_op" in test_name
|
||||
skip_it |= skip_io_module and is_io_module
|
||||
skip_it |= skip_fstring and is_fstring
|
||||
skip_it |= skip_inlineasm and is_inlineasm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user