another primitive debug helper

This commit is contained in:
Jean-Paul Calderone 2019-03-14 09:02:46 -04:00
parent cc5ebd2350
commit 0902277613

View File

@ -187,7 +187,7 @@ def _open_directory(path_u):
def simple_test():
path_u = u"test"
filter = FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE
recursive = FALSE
recursive = TRUE
hDirectory = _open_directory(path_u)
fni = FileNotifyInformation()
@ -198,6 +198,27 @@ def simple_test():
for info in fni:
print info
def medium_test():
from twisted.python.filepath import FilePath
def print_(*event):
print(event)
notifier = INotify()
notifier.set_pending_delay(1.0)
IN_EXCL_UNLINK = 0x04000000L
mask = ( IN_CREATE
| IN_CLOSE_WRITE
| IN_MOVED_TO
| IN_MOVED_FROM
| IN_DELETE
| IN_ONLYDIR
| IN_EXCL_UNLINK
)
notifier.watch(FilePath(u"test"), mask, callbacks=[print_], recursive=True)
notifier.startReading()
reactor.run()
NOT_STARTED = "NOT_STARTED"
STARTED = "STARTED"