micropython/tests/unix/mod_os.py
stijn 83f2f36b9e tests/unix/mod_os: Make os.system() test work on windows.
The "true" command by default is unavailable on windows so use
an equivalent which works on both unix and windows.

Signed-off-by: stijn <stijn@ignitron.net>
2023-09-01 14:08:58 +10:00

22 lines
438 B
Python

# This module is not entirely compatible with CPython
import os
os.putenv("TEST_VARIABLE", "TEST_VALUE")
print(os.getenv("TEST_VARIABLE"))
print(os.getenv("TEST_VARIABLE", "TEST_DEFAULT_VALUE"))
os.unsetenv("TEST_VARIABLE")
print(os.getenv("TEST_VARIABLE"))
print(os.getenv("TEST_VARIABLE", "TEST_DEFAULT_VALUE"))
print(os.system("exit 0"))
rand = os.urandom(4)
print(type(rand) is bytes, len(rand))
os.errno(2)
print(os.errno())