From f4494c307eb5cf4200fd678dff90f1c2b5a5775e Mon Sep 17 00:00:00 2001 From: ionite34 Date: Mon, 28 Nov 2022 09:44:11 +0800 Subject: Add cleanup for LibMountTests --- tests/test_libmount.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests/test_libmount.py') diff --git a/tests/test_libmount.py b/tests/test_libmount.py index a9a5e5b..7d02d1a 100644 --- a/tests/test_libmount.py +++ b/tests/test_libmount.py @@ -1,6 +1,7 @@ from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager, suppress from pathlib import Path +from shutil import rmtree from unittest import TestCase from uuid import uuid4 @@ -8,10 +9,15 @@ from snekbox import libmount class LibMountTests(TestCase): - def setUp(self): - self.temp_dir = Path("/tmp/snekbox-test") - self.temp_dir.mkdir(exist_ok=True, parents=True) - super().setUp() + temp_dir = Path("/tmp/snekbox") + + @classmethod + def setUpClass(cls): + cls.temp_dir.mkdir(exist_ok=True, parents=True) + + @classmethod + def tearDownClass(cls): + rmtree(cls.temp_dir, ignore_errors=True) @contextmanager def get_mount(self): -- cgit v1.2.3