diff --git a/tests.py b/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..829a0926c091fd1dcb12212f92bbd3f550a5a147 --- /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)