micropython/tests/unicode
Jim Mussared 17127bbee5 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-18 13:48:21 +10:00
..
data tests/unicode: Add test for invalid utf-8 file contents. 2022-08-26 16:47:27 +10:00
file1.py tests/run-tests.py: Ensure correct cwd for mpy tests. 2023-05-18 13:48:21 +10:00
file2.py tests/run-tests.py: Ensure correct cwd for mpy tests. 2023-05-18 13:48:21 +10:00
file_invalid.py tests/run-tests.py: Ensure correct cwd for mpy tests. 2023-05-18 13:48:21 +10:00
unicode.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
unicode_chr.py tests: Add missing tests for builtins, and many other things. 2015-04-04 22:05:30 +01:00
unicode_id.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
unicode_index.py tests: Add tests for unicode find()/rfind()/index(). 2014-06-27 00:04:19 +03:00
unicode_iter.py tests: Add test for unicode string iteration. 2014-06-27 00:04:19 +03:00
unicode_ord.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
unicode_pos.py tests: Test for explicit start/end args to str methods for unicode. 2014-06-27 00:04:20 +03:00
unicode_slice.py py/objslice: Add support for indices() method on slice objects. 2019-12-28 23:55:15 +11:00
unicode_str_format.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
unicode_str_modulo.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
unicode_subscr.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
unicode_ure.py extmod/modure: Convert byte offsets to unicode indices when necessary. 2022-09-06 17:08:18 +10:00