Paul Sokolovsky
5c34c2ff7f
tests/io: Update tests to use uos.remove() instead of uos.unlink().
After Unix port switches from one to another, to be consistent with
baremetal ports.
6 years ago
Damien George
726804ea40
tests: Move non-filesystem io tests to basics dir with io_ prefix.
6 years ago
Damien George
b92a8adbfa
tests: Add tests using "file" argument in print and sys.print_exception.
6 years ago
Damien George
9144b1f10c
tests/io: Add simple IOBase test.
7 years ago
Mike Wadsten
9f1eafc380
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.
7 years ago
Paul Sokolovsky
e3383e9352
py/stream: seek: Consistently handle negative offset for SEEK_SET.
Per POSIX, this is EINVAL, so raises OSError(EINVAL).
7 years ago
Alexander Steffen
55f33240f3
all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
7 years ago
Paul Sokolovsky
85d809d1f4
tests: Convert remaining "sys.exit()" to "raise SystemExit".
8 years ago
Paul Sokolovsky
07241cd37a
py/objstringio: If created from immutable object, follow copy on write policy.
Don't create copy of immutable object's contents until .write() is called
on BytesIO.
8 years ago
Tom Collins
162a0f942b
tests/io/bytesio_ext: Test read() after seek() past end of BytesIO object.
8 years ago
Paul Sokolovsky
4a4490ffcc
py/modio: resource_stream: Implement "package" param handling.
8 years ago
Paul Sokolovsky
7d4ba9d257
tests/io/resource_stream: Add test for uio.resource_stream().
8 years ago
Rami Ali
cba723fc8c
tests/io: Improve test coverage of io.BufferedWriter.
8 years ago
Paul Sokolovsky
8212773adb
tests: Use read() instead of readall().
8 years ago
Paul Sokolovsky
3dabaae47d
tests/io/bytesio_ext: Add test for readinto().
8 years ago
Paul Sokolovsky
49e140488d
tests/io/write_ext: Add description comment.
8 years ago
Paul Sokolovsky
abd5a57ea1
tests/io/bytesio_ext: Test for .seek()/.flush() on BytesIO.
8 years ago
Paul Sokolovsky
0b52228739
tests: Add test for extended arguments to stream .write() method.
8 years ago
Paul Sokolovsky
566d8f1d7e
tests: Make "io" modules fixes for CPython compatibility.
Previously, "import _io" worked on both CPython and MicroPython (essentially
by a chance on CPython, as there's not guarantee that its contents will stay
the same across versions), but as the module was renamed to uio, need to use
more robust import sequence for compatibility.
9 years ago
Paul Sokolovsky
8c35f3979c
tests: Update for _io/_collections module having been renamed.
9 years ago
Paul Sokolovsky
88f60de914
tests: Add test for io.BufferedWriter.
9 years ago
Damien George
99146ea444
tests/io: Remove "testfile" at end of open_plus test.
9 years ago
Paul Sokolovsky
5bf6eba845
tests/open_plus: Add tests for "r+", "w+" open modes.
9 years ago
Damien George
117158fcd5
tests: Add tests for stream IO errors.
9 years ago
Paul Sokolovsky
a6eff059b9
unix: Rename "_os" module to "uos" for consistency with baremetal ports.
9 years ago
Damien George
d292a81e95
tests: Make io test cleanup after itself by removing 'testfile'.
9 years ago
blmorris
bdd78c31b6
py: Add stream_tell method, and use for unix and stmhal file tell.
9 years ago
Paul Sokolovsky
a06c38b486
tests: Add testcase for open(..., "a").
10 years ago
Damien George
9dd3640464
tests: Add missing tests for builtins, and many other things.
10 years ago
Damien George
92ab95f215
tests: Add some tests to improve coverage.
10 years ago
Paul Sokolovsky
66b060f3e6
tests: Fix typo in file_long_read3.py.
10 years ago
Paul Sokolovsky
1f04336b23
tests: Add extra test for reading multiple of internal chunk size.
10 years ago
Paul Sokolovsky
220d21e1bf
tests: Add testcase for reading amounts bigger than buffer/chunk size.
10 years ago
stijn
bf19541f46
py: Prevent segfault for operations on closed StringIO.
Addresses issue #1067 .
10 years ago
Damien George
5694cc5490
py: Make stream seek correctly check for ioctl fn; add seek for textio.
10 years ago
Paul Sokolovsky
c7d5500142
tests: Add test for file.seek().
10 years ago
Paul Sokolovsky
e2f8d98525
stream: Add optional 2nd "length" arg to .readinto() - extension to CPython.
While extension to file.readinto() definition of CPython, the additional arg
is similar to what in CPython available in socket.recv_into().
10 years ago
stijn
a3efe04dce
Use mode/encoding kwargs in io and unicode tests
mode argument is used to assert it works
encoding argument is used to make sure CPython uses the correct encoding
as it does not automatically use utf-8
10 years ago
Paul Sokolovsky
1a55b6a787
unix, stmhal: Implement file.readinto() method.
Also, usocket.readinto(). Known issue is that .readinto() should be available
only for binary files, but micropython uses single method table for both
binary and text files.
10 years ago
Paul Sokolovsky
512465bc66
tests: Add testcase for read by length past EOF.
Currently broken for unicode input streams.
10 years ago
Damien George
539681fffd
tests: Rename test scripts, changing - to _ for consistency.
From now on, all new tests must use underscore.
Addresses issue #727 .
10 years ago
Paul Sokolovsky
fbdf2f1d63
py: Rename builtin "io" to "_io".
Functionality we provide in builtin io module is fairly minimal. Some
code, including CPython stdlib, depends on more functionality. So, there's
a choice to either implement it in C, or move it _io, and let implement other
functionality in Python. 2nd choice is pursued. This setup matches CPython
too (_io is builtin, io is Python-level).
11 years ago
Damien George
d5f5b2f766
py, stream: Implement readlines for a stream.
11 years ago
Paul Sokolovsky
cb9dc086a3
modio: Implement io.StringIO class.
11 years ago
Paul Sokolovsky
072cf022e0
tests/file-with: Add testcase which failed for @dpgeorge .
Works on x86.
11 years ago
Paul Sokolovsky
c61ce96590
unix file: Implement context manager protocol (for "with" statement).
11 years ago
Paul Sokolovsky
1e19b24ea0
io.File, socket types: Add fileno() method.
Implementation is duplicated, but tolerate this for now, because there's
no clear idea how to de-dup it.
11 years ago
Paul Sokolovsky
decd597273
unix io.FileIO: Add iteration support.
A file cannot be iterated concurrently, so we make io.FileIO its own
iterator.
11 years ago
Paul Sokolovsky
fe2690da0a
unix: Implement sys.argv.
11 years ago
Paul Sokolovsky
9954b4b99d
Add directory for I/O tests with basic test for file methods.
11 years ago