File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -76,15 +76,17 @@ def log_and_raise_if_target_directory_within_source_directory(path_source_dir: p
7676 >>> path_target_dir_ok=pathlib.Path('./test2/test')
7777 >>> path_target_dir_err=pathlib.Path('./test/test2')
7878
79- >>> # Test OK
80- >>> log_and_raise_if_target_directory_within_source_directory(path_source_dir, path_target_dir_ok)
81-
8279 >>> # Test ERR
8380 >>> log_and_raise_if_target_directory_within_source_directory(path_source_dir, path_target_dir_err)
8481 Traceback (most recent call last):
8582 ...
8683 FileExistsError: target directory: "..." is within the source directory "..."
8784
85+
86+ >>> # Test OK
87+ >>> log_and_raise_if_target_directory_within_source_directory(path_source_dir, path_target_dir_ok)
88+
89+
8890 """
8991 if is_target_directory_within_source_directory (path_source_dir , path_target_dir ):
9092 s_error = 'target directory: "{}" is within the source directory "{}"' .format (path_target_dir , path_source_dir )
@@ -95,6 +97,7 @@ def log_and_raise_if_target_directory_within_source_directory(path_source_dir: p
9597def is_target_directory_within_source_directory (path_source_dir : pathlib .Path , path_target_dir : pathlib .Path ) -> bool :
9698 s_source_dir = str (path_source_dir .resolve ()) + '/'
9799 s_target_dir = str (path_target_dir .resolve ()) + '/'
100+ logger .error ('S:' + s_source_dir + ' T:' + s_target_dir )
98101 if s_target_dir .startswith (s_source_dir ):
99102 return True
100103 else :
You can’t perform that action at this time.
0 commit comments