From 2897951ce19ff501b493e35f448f1621b8b1be20 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 17 Jul 2019 16:54:59 -0400 Subject: [PATCH] tests: Drop os.system calls Use python native code instead. This seems to avoid an occasional crash or abort of some sort with latest libosinfo --- tests/clitest.py | 4 ++-- tests/clonetest.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/clitest.py b/tests/clitest.py index 40041184..ddc84c8e 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -1420,8 +1420,8 @@ def cleanup(): Cleanup temporary files used for testing """ for i in clean_files: - os.system("chmod 777 %s > /dev/null 2>&1" % i) - os.system("rm -rf %s > /dev/null 2>&1" % i) + if os.path.exists(i): + os.unlink(i) class CLITests(unittest.TestCase): diff --git a/tests/clonetest.py b/tests/clonetest.py index ee0c72d7..d9d6f288 100644 --- a/tests/clonetest.py +++ b/tests/clonetest.py @@ -35,7 +35,7 @@ class TestClone(unittest.TestCase): def setUp(self): for f in local_files: - os.system("touch %s" % f) + open(f, "w").write("") def tearDown(self): for f in local_files: