tests/unix/mod_os: Add test for os module.
This adds a test to get coverage of the unix port-specific implementation of the `os` module. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
parent
958f748e53
commit
3c2d7563d2
21
tests/unix/mod_os.py
Normal file
21
tests/unix/mod_os.py
Normal file
@ -0,0 +1,21 @@
|
||||
# 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("true"))
|
||||
|
||||
rand = os.urandom(4)
|
||||
print(type(rand) is bytes, len(rand))
|
||||
|
||||
os.errno(2)
|
||||
print(os.errno())
|
7
tests/unix/mod_os.py.exp
Normal file
7
tests/unix/mod_os.py.exp
Normal file
@ -0,0 +1,7 @@
|
||||
TEST_VALUE
|
||||
TEST_VALUE
|
||||
None
|
||||
TEST_DEFAULT_VALUE
|
||||
0
|
||||
True 4
|
||||
2
|
Loading…
Reference in New Issue
Block a user