fix remove_local_directory_contents

This commit is contained in:
Michael Stetsyuk 2024-08-01 14:42:58 +01:00
parent 7dbd3d7534
commit 1d85f9b1cb

View File

@ -52,9 +52,13 @@ def get_spark():
return builder.master("local").getOrCreate()
def remove_local_directory_contents(local_path):
for local_file in glob.glob(local_path + "/**"):
os.unlink(local_file)
def remove_local_directory_contents(full_path):
for path in glob.glob(f"{full_path}/**"):
if os.path.isfile(path):
os.unlink(path)
else:
remove_local_directory_contents(path)
os.rmdir(path)
@pytest.fixture(scope="module")