diff --git a/tests/func/test_utils.py b/tests/func/test_utils.py index c764a80e45..594fdc332d 100644 --- a/tests/func/test_utils.py +++ b/tests/func/test_utils.py @@ -76,16 +76,15 @@ def test_boxify(self): @pytest.mark.skipif(os.name == "nt", reason="Not supported for Windows.") -def test_makedirs_permissions(): +def test_makedirs_permissions(tmpdir): dir_mode = 0o755 + os.chdir(str(tmpdir)) intermediate_dir = "тестовая-директория" test_dir = os.path.join(intermediate_dir, "data") assert not os.path.exists(intermediate_dir) - try: - utils.makedirs(test_dir, mode=dir_mode) - assert stat.S_IMODE(os.stat(test_dir).st_mode) == dir_mode - assert stat.S_IMODE(os.stat(intermediate_dir).st_mode) == dir_mode - finally: - shutil.rmtree(intermediate_dir) + utils.makedirs(test_dir, mode=dir_mode) + + assert stat.S_IMODE(os.stat(test_dir).st_mode) == dir_mode + assert stat.S_IMODE(os.stat(intermediate_dir).st_mode) == dir_mode