From f074288d2192887eee2b96ec6605f9b264a05f3c Mon Sep 17 00:00:00 2001 From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de> Date: Fri, 21 Apr 2023 11:23:02 +0200 Subject: [PATCH] add tests --- tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests.py diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..829a092 --- /dev/null +++ b/tests.py @@ -0,0 +1,21 @@ +import os +import pytest + +from install_mpsd_software_environment import os_chdir, build_toolchains + +def test_os_chdir(): + # create a temporary directory for testing + temp_dir = "/tmp/test_os_chdir" + os.mkdir(temp_dir) + # initial current working directory + initial_cwd = os.getcwd() + + # change to the temporary directory using os_chdir + with os_chdir(temp_dir): + assert os.getcwd() == os.path.abspath(temp_dir) + + # current working directory should be back to initial directory + assert os.getcwd() == initial_cwd + + # clean up the temporary directory + os.rmdir(temp_dir) -- GitLab