Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remove_watch+ base tree.event gen #61

Closed
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .coverage
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/dustin/development/python/pyinotify/inotify/__init__.py":[1],"/home/eohm/github/Elias481/PyInotify/inotify/constants.py":[3,4,8,9,10,11,12,13,14,15,16,17,18,19,23,24,30,34,35,36,40,41,42,43,44,46,47,48,52,53,54,55,56,57,58,59,60,61,62,63,67,68,69,73,74,75,76,77],"/home/eohm/github/Elias481/PyInotify/inotify/adapters.py":[1,2,3,4,5,6,8,10,11,15,16,20,25,27,28,30,31,32,33,36,37,40,41,44,45,50,51,52,53,54,55,57,58,60,61,63,65,68,71,72,73,75,77,78,79,81,82,89,90,91,93,95,96,98,99,101,103,104,105,107,108,109,110,111,112,113,114,116,117,118,120,121,123,124,126,127,128,129,130,131,132,133,135,136,138,140,141,142,143,144,145,146,147,148,150,152,153,155,158,159,161,162,163,164,165,167,168,169,171,172,173,175,176,177,178,179,180,181,182,183,184,185,187,188,189,190,192,193,194,195,196,197,199,200,201,203,204,205,209,210,213,215,216,217,221,222,224,227,228,230,231,232,234,235,236,239,240,242,243,244,245,246,247,248,250,252,253,255,257,258,259,260,262,265,266,267,269,270,271,272,278,279,280,281,282,283,284,285,288,289,292,293,294,295,296,297,300,301,302,303,304,306,307,309,310,311,312,314,315,316,317,318,320,321,322,323,324,326,327,329,331,332,333,334,335,336,338,339,340,341,342,343,345,347,348,349,350,352,354,355,356,357,359,361,362,363,365,366,368,369,370,372,373,374,375,376,377,379,380,381,382,384,386,387,388,389,391,393,394,395,401,402],"/home/eohm/github/Elias481/PyInotify/inotify/library.py":[1,2,4,5,8],"/home/eohm/github/Elias481/PyInotify/inotify/test_support.py":[1,2,3,4,5,7,9,11,13,14,16,17,19,21,22],"/home/eohm/github/Elias481/PyInotify/inotify/calls.py":[1,2,4,6,8,11,12,18,25,32,33,37,39,40,41,43,45,46,47,49,51,52,53,55,56],"/home/dustin/development/python/pyinotify/inotify/library.py":[8,1,2,4,5],"/home/dustin/development/python/pyinotify/inotify/adapters.py":[1,2,3,4,5,6,8,10,11,15,16,20,22,23,25,26,27,28,31,32,35,36,39,40,41,42,43,44,46,47,49,51,53,56,59,60,61,63,65,66,67,69,70,72,73,75,76,78,84,85,88,89,91,92,93,95,97,98,99,100,101,102,104,105,107,110,112,115,117,118,121,123,124,126,132,134,135,136,138,139,141,142,145,148,150,152,153,154,161,162,163,165,170,171,172,176,177,191,194,195,196,197,199,200,201,202,204,208,209,210,216,217,219,221,230,231,232,234,235,238,239,242,245,247,250,252,253,256,259,261,264,265,267,268,269,271,273,275,276,278,280,281,282,283,285,287,288,289,292,294,295,298,299,301,302,303,305,307,308,310,312,313,314,315,317,319,327,328],"/home/eohm/github/Elias481/PyInotify/inotify/__init__.py":[1],"/home/dustin/development/python/pyinotify/inotify/test_support.py":[1,2,3,4,5,7,9,11,13,14,16,17,19,21,22],"/home/dustin/development/python/pyinotify/inotify/calls.py":[1,2,4,6,8,11,12,18,25,32,33,37,39,40,41,43,45,46,47,49,51,52,53,55,56],"/home/dustin/development/python/pyinotify/inotify/constants.py":[3,4,8,9,10,11,12,13,14,15,16,17,18,19,23,24,30,34,35,36,40,41,42,43,44,46,47,48,52,53,54,55,56,57,58,59,60,61,62,63,67,68,69,73,74,75,76,77]}}
!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/eohm/github/Elias481/PyInotify/inotify/library.py":[1,2,4,5,8],"/home/eohm/github/Elias481/PyInotify/inotify/__init__.py":[1],"/home/eohm/github/Elias481/PyInotify/inotify/test_support.py":[1,2,3,4,5,7,9,11,13,14,16,17,19,21,22],"/home/eohm/github/Elias481/PyInotify/inotify/calls.py":[1,2,4,6,8,11,12,18,25,32,33,37,39,40,41,43,45,46,47,49,51,52,53,55,56],"/home/eohm/github/Elias481/PyInotify/inotify/constants.py":[3,4,8,9,10,11,12,13,14,15,16,17,18,19,23,24,30,34,35,36,40,41,42,43,44,46,47,48,52,53,54,55,56,57,58,59,60,61,62,63,67,68,69,73,74,75,76,77],"/home/eohm/github/Elias481/PyInotify/inotify/adapters.py":[1,2,3,4,5,6,8,10,11,15,16,20,25,27,28,30,31,32,33,36,37,40,41,44,45,50,51,52,53,54,55,57,58,60,61,63,65,68,71,72,73,75,77,78,79,81,82,89,93,95,96,98,99,101,103,104,105,107,108,109,110,111,112,113,114,117,126,127,130,132,140,141,142,143,144,145,147,148,150,153,155,158,159,162,164,165,167,173,175,176,177,179,180,181,183,184,187,190,192,194,195,196,197,199,200,201,204,205,213,215,216,217,221,222,236,239,240,242,243,244,246,247,248,252,255,257,258,259,260,262,265,270,271,272,283,284,286,288,297,298,299,301,302,305,306,309,319,321,324,326,327,330,333,334,335,339,341,342,349,351,356,357,359,360,361,363,365,367,368,370,372,373,374,375,377,379,380,381,384,386,387,390,391,393,394,395,397,399,400,402,404,405,406,407,409,411,419,420]}}
32 changes: 32 additions & 0 deletions tests/test_inotify.py
Original file line number Diff line number Diff line change
@@ -349,6 +349,38 @@ def test__automatic_new_watches_on_existing_paths(self):

self.assertEquals(events, expected)

def test__moving_readded_folder(self):
#test for https://github.com/dsoprea/PyInotify/issues/46
#doing no checks of genereated events as current master does
#not generate events that should really be expected in this case
#avoid having to adjust this - also not implement chcking for expected
#wd assignment now..
#just check for no exception and expected watches in the end
#emulate slow mkdir/rmdir/rename... (because of another unfixed bug and
#because this is needed to reproduces issue)
with inotify.test_support.temp_path() as path:
path1 = os.path.join(path, 'org_folder')
path2 = os.path.join(path, 'ren_folder')

i = inotify.adapters.InotifyTree(path)
os.mkdir(path1)
events = self.__read_all_events(i)
os.rmdir(path1)
events = self.__read_all_events(i)
os.mkdir(path1)
events = self.__read_all_events(i)
os.rename(path1, path2)
events = self.__read_all_events(i)

watches = i._i._Inotify__watches
watches_reverse = i._i._Inotify__watches_r

watches_expect = sorted((path,path2))
watches_reg_names = sorted(sorted(watches.keys()))
watches_reg_check = dict((value, key) for key, value in watches.items())

self.assertEquals(watches_expect, watches_reg_names)
self.assertEquals(watches_reg_check, watches_reverse)

class TestInotifyTrees(unittest.TestCase):
def __init__(self, *args, **kwargs):