This website requires JavaScript.
Explore
Help
Sign In
djsundog
/
circuitpython
Watch
1
Star
0
Fork
0
You've already forked circuitpython
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
a14eb26d4b
circuitpython
/
tests
/
io
/
file_iter.py
4 lines
48 B
Python
Raw
Normal View
History
Unescape
Escape
tests/run-tests.py: Ensure correct cwd for mpy tests. Previously when using --via-mpy, the file was compiled to tests/<tmp>.mpy and then run using `micropython -m <tmp>` in the current cwd (usually tests/). This meant that an import in the test would be resolved relative to tests/. This is different to regular (non-via-mpy) tests, where we run (for example) `micropython basics/test.py` which means that an import would be resolved relative to basics/. Now --via-mpy matches the .py behavior. This is important because: a) It makes it so import tests do the right thing. b) There are directory names in tests/ that match built-in module names. Furthermore, it always ensures the cwd (for both micropython and cpython) is the test directory (e.g. basics/) rather than being left unset. This also makes it clearer inside the test that e.g. file access is relative to the Python file. Updated tests with file paths to match. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-11 00:28:35 -04:00
f
=
open
(
"
data/file1
"
)
unix io.FileIO: Add iteration support. A file cannot be iterated concurrently, so we make io.FileIO its own iterator.
2014-01-20 11:38:27 -05:00
for
l
in
f
:
print
(
l
)
Reference in New Issue
Copy Permalink