Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
fix two bugs introduced with previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed May 27, 2018
1 parent 7095acc commit f7d16fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions _unittests/ut_filehelper/test_syncho_hash.py
Expand Up @@ -89,11 +89,12 @@ def filter_copy(file):
b = synchronize_folder(data, troi, hash_size=0, repo1=True,
filter_copy=filter_copy, file_date=file_date)

if len(a)not in [2, 3]:
if len(a) not in [6, 7, 8]:
raise Exception(
"2 or 3 expected: " + "\n".join([str(_) for _ in a]))
assert a[0][0] == ">+" == a[1][0]
assert len(b) == 0
self.assertEqual(a[0][0], ">+")
self.assertEqual(a[0][0], a[1][0])
self.assertEqual(len(b), 0)

troi2 = os.path.join(fold, "temp_troi3")
if not os.path.exists(troi2):
Expand Down
8 changes: 4 additions & 4 deletions src/pyquickhelper/filehelper/synchelper.py
Expand Up @@ -374,7 +374,7 @@ def regtrue2(f):
elif n2 is not None and n1._size != n2._size and not n1.isdir():
fLOG("[synchronize_folder] problem: size are different for file %s (%d != %d) dates (%s,%s) (op %s)" % (
file, n1._size, n2._size, n1._date, n2._date, op))
# n1.copy_to (f2)
# n1.copy_to(f2)
# raise Exception ("size are different for file %s (%d != %d) (op %s)" % (file, n1._size, n2._size, op))

if status is not None:
Expand Down Expand Up @@ -426,9 +426,9 @@ def remove_folder(top, remove_also_top=True, raise_exception=True):
if first_root is None:
first_root = root

if first_root is not None and remove_also_top:
res.append((first_root, "dir"))
os.rmdir(first_root)
if top is not None and remove_also_top:
res.append((top, "dir"))
os.rmdir(top)

return res

Expand Down

0 comments on commit f7d16fc

Please sign in to comment.