Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
przadka committed Apr 28, 2023
1 parent 1caf715 commit e8e17ef
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test/unit/scan/test_scan_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ def test_folder_with_symlink_to_file(self, tmp_path):
folder = LocalFolder(str(tmp_path))
local_paths = folder.all_files(reporter=MagicMock())

absolute_paths = [fix_windows_path_limit(path.absolute_path) for path in list(local_paths)]
absolute_paths = [path.absolute_path for path in list(local_paths)]

assert len(absolute_paths) == 2
assert absolute_paths == [str(file), str(symlink_file)]
assert absolute_paths == [
fix_windows_path_limit(str(file)),
fix_windows_path_limit(str(symlink_file))
]

#FIXME the following two tests could be combined to avoid code duplication
# but I decide to keep them separate for now to make it easier to debug
Expand All @@ -98,16 +101,16 @@ def test_folder_with_circular_symlink(self, tmp_path):
policies_manager.max_symlink_visits = 3

local_paths = folder.all_files(reporter=MagicMock(), policies_manager=policies_manager)
absolute_paths = [
str(fix_windows_path_limit(path.absolute_path)) for path in list(local_paths)
]
absolute_paths = [str(path.absolute_path) for path in list(local_paths)]

assert len(absolute_paths) == 4
assert absolute_paths == [
str(d / "file1.txt"),
str(d / "symlink_dir" / "file1.txt"),
str(d / "symlink_dir" / "symlink_dir" / "file1.txt"),
str(d / "symlink_dir" / "symlink_dir" / "symlink_dir" / "file1.txt"),
fix_windows_path_limit(str(d / "file1.txt")),
fix_windows_path_limit(str(d / "symlink_dir" / "file1.txt")),
fix_windows_path_limit(str(d / "symlink_dir" / "symlink_dir" / "file1.txt")),
fix_windows_path_limit(
str(d / "symlink_dir" / "symlink_dir" / "symlink_dir" / "file1.txt")
),
]

@pytest.mark.timeout(5) # Set a 5-second timeout for this test
Expand Down

0 comments on commit e8e17ef

Please sign in to comment.