Skip to content

Commit c9299b5

Browse files
committed
Try to fix tests
1 parent d1f5e5f commit c9299b5

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

tests/test_filebrowser.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ def test_filebrowser_opendir(self):
2525
fb.validate()
2626
walk = os.walk(path)
2727
root, dirs, _ = walk.send(None)
28-
# res = list(fb.right_tree.selection())
2928
res = list(fb.get_result())
3029
res.sort()
31-
dirs = [os.path.join(root, d) for d in dirs]
30+
dirs = [os.path.realpath(os.path.join(root, d)) for d in dirs]
3231
dirs.sort()
3332
self.assertEqual(res, dirs)
3433
# --- single selection
@@ -43,20 +42,24 @@ def test_filebrowser_opendir(self):
4342

4443
def test_filebrowser_openfile(self):
4544
# --- multiple selection
46-
fb = FileBrowser(self.window, initialdir=".", initialfile="test", mode="openfile",
45+
path = os.path.expanduser('~')
46+
fb = FileBrowser(self.window, initialdir=path, initialfile="test", mode="openfile",
4747
multiple_selection=True, defaultext=".png",
4848
title="Test", filetypes=[],
4949
okbuttontext=None, cancelbuttontext="Cancel",
5050
foldercreation=False)
5151
self.window.update()
52+
fb.right_tree.focus_force()
53+
self.window.update()
5254
fb.event_generate('<Control-a>')
5355
self.window.update()
56+
self.window.update_idletasks()
5457
fb.validate()
55-
walk = os.walk(os.path.abspath("."))
58+
walk = os.walk(path)
5659
root, _, files = walk.send(None)
5760
res = list(fb.get_result())
5861
res.sort()
59-
files = [os.path.join(root, d) for d in files]
62+
files = [os.path.realpath(os.path.join(root, f)) for f in files]
6063
files.sort()
6164
self.assertEqual(res, files)
6265
# --- single selection

tkfilebrowser/filebrowser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,9 @@ def _right_tree_select_all(self, event):
459459
tags = ['folder', 'folder_link']
460460
else:
461461
tags = ['file', 'file_link']
462-
items = list(self.right_tree.tag_has(tags[0]))
463-
items.extend(self.right_tree.tag_has(tags[1]))
462+
items = self.right_tree.tag_has(tags[0]) + self.right_tree.tag_has(tags[1])
464463
self.right_tree.selection_clear()
465-
self.right_tree.selection_set(*items)
464+
self.right_tree.selection_set(items)
466465

467466
def _select_all(self, event):
468467
"""Select all entry content."""

0 commit comments

Comments
 (0)