From 8516d1738eeddd8be250185d02752e84d4f8c585 Mon Sep 17 00:00:00 2001 From: Donny Wong Date: Mon, 25 Mar 2024 15:09:50 -0400 Subject: [PATCH] clean up code --- server/autotest_server/tests/test_autotest_server.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/autotest_server/tests/test_autotest_server.py b/server/autotest_server/tests/test_autotest_server.py index c6b125f0..14613575 100644 --- a/server/autotest_server/tests/test_autotest_server.py +++ b/server/autotest_server/tests/test_autotest_server.py @@ -1,3 +1,4 @@ +import subprocess from pwd import getpwnam import pytest @@ -36,9 +37,12 @@ def test_sticky(): path = f'{autotest_worker_working_dir}/test_sticky' if not os.path.exists(path): - os.system(f"sudo -u {autotest_worker} mkdir {path}") - os.system(f"sudo -u {autotest_worker} chmod 000 {path}") - os.system(f"sudo -u {autotest_worker} chmod +t {path}") + mkdir_cmd = f"sudo -u {autotest_worker} mkdir {path}" + chmod_cmd = f"sudo -u {autotest_worker} chmod 000 {path}" + chmod_sticky_cmd = f"sudo -u {autotest_worker} chmod +t {path}" + subprocess.run(mkdir_cmd, shell=True) + subprocess.run(chmod_cmd, shell=True) + subprocess.run(chmod_sticky_cmd, shell=True) autotest_server._clear_working_directory(autotest_worker_working_dir, autotest_worker)