Skip to content

Commit

Permalink
refactored in folder_delete method
Browse files Browse the repository at this point in the history
removed pytest-cov dependency
  • Loading branch information
DinisCruz committed Oct 27, 2023
1 parent bedcc28 commit e0c2bf9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 11 additions & 0 deletions osbot_utils/utils/Files.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ def folder_create_in_parent(path, name):
folder_path = path_combine(path, name)
return folder_create(folder_path)

@staticmethod
def folder_delete(target_folder):
if folder_exists(target_folder):
try:
os.rmdir(target_folder)
return True
except OSError:
pass
return False

@staticmethod
def folder_delete_all(path): # this will remove recursively
if folder_exists(path):
Expand Down Expand Up @@ -442,6 +452,7 @@ def write_gz(path=None, contents=None):
folder_create_temp = Files.temp_folder
folder_copy = Files.folder_copy
folder_copy_except = Files.folder_copy
folder_delete = Files.folder_delete
folder_delete_all = Files.folder_delete_all
folder_delete_recursively = Files.folder_delete_all
folder_exists = Files.folder_exists
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ pyyaml

# for development
pytest
pytest-cov
coveralls
pdoc3
1 change: 0 additions & 1 deletion tests/utils/test_Files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from unittest import TestCase

from osbot_jira._extra_osbot_methods import folder_delete
from osbot_utils.testing.Temp_File import Temp_File
from osbot_utils.testing.Temp_Folder import Temp_Folder
from osbot_utils.utils.Dev import pprint
Expand Down

0 comments on commit e0c2bf9

Please sign in to comment.