mirror of
https://github.com/micropython/micropython.git
synced 2025-09-06 01:40:34 +02:00
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>
17 lines
324 B
Python
17 lines
324 B
Python
try:
|
|
import io
|
|
|
|
io.IOBase
|
|
except (AttributeError, ImportError):
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
class MyIO(io.IOBase):
|
|
def write(self, buf):
|
|
# CPython and uPy pass in different types for buf (str vs bytearray)
|
|
print('write', len(buf))
|
|
return len(buf)
|
|
|
|
print('test', file=MyIO())
|