island: Remove tmpdir cleanup code from test_utils.py

Pytest automatically cleans up tmpdir fixtures older than 3 runs. See
https://docs.pytest.org/en/6.2.x/tmpdir.html#the-default-base-temporary-directory

Windows10 and Linux will automatically clean their temp directories.
This commit is contained in:
Mike Salvatore 2021-06-09 10:36:37 -04:00
parent 00b37ca6a5
commit b98ebc8a69
1 changed files with 4 additions and 11 deletions

View File

@ -1,5 +1,4 @@
import os import os
import shutil
import stat import stat
import pytest import pytest
@ -11,22 +10,16 @@ from monkey_island.cc.environment.utils import create_secure_directory, is_windo
def test_path_nested(tmpdir): def test_path_nested(tmpdir):
nested_path = "test1/test2/test3" nested_path = "test1/test2/test3"
path = os.path.join(tmpdir, nested_path) path = os.path.join(tmpdir, nested_path)
yield path
try: return path
shutil.rmtree(os.path.join(tmpdir, "test1"))
except Exception:
pass
@pytest.fixture @pytest.fixture
def test_path(tmpdir): def test_path(tmpdir):
test_path = "test1" test_path = "test1"
path = os.path.join(tmpdir, test_path) path = os.path.join(tmpdir, test_path)
yield path
try: return path
shutil.rmtree(path)
except Exception:
pass
def test_create_secure_directory__parent_dirs(test_path_nested): def test_create_secure_directory__parent_dirs(test_path_nested):