From 62aa3ce26a823710571a6341ccf0872ecd174eba Mon Sep 17 00:00:00 2001 From: Johannes Keyser Date: Mon, 5 Jun 2017 19:26:01 +0200 Subject: [PATCH] disks: delete existing test file, if necessary --- plinth/modules/disks/tests/test_disks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/modules/disks/tests/test_disks.py b/plinth/modules/disks/tests/test_disks.py index fe78571cd..4515cbb32 100644 --- a/plinth/modules/disks/tests/test_disks.py +++ b/plinth/modules/disks/tests/test_disks.py @@ -53,6 +53,9 @@ class Disk(): directory = os.path.dirname(os.path.realpath(__file__)) disk_file = os.path.join(directory, 'temp_disk.img') + if os.path.isfile(disk_file): + os.remove(disk_file) + command = 'dd if=/dev/zero of={file} bs=1M count={size}' \ .format(size=self.size, file=disk_file) subprocess.run(command.split(), stderr=subprocess.DEVNULL, check=True)