From 3c2d7563d26ab457c84e6392c103bce6d2fc6e02 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 13 Dec 2022 12:08:12 -0600 Subject: 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 --- tests/unix/mod_os.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/unix/mod_os.py (limited to 'tests/unix/mod_os.py') diff --git a/tests/unix/mod_os.py b/tests/unix/mod_os.py new file mode 100644 index 000000000..17554d937 --- /dev/null +++ b/tests/unix/mod_os.py @@ -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()) -- cgit v1.2.3