Skip to content

Commit

Permalink
woo! all tests pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Dario committed Nov 10, 2012
1 parent f74e42c commit a026c24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 3 additions & 1 deletion imagy/cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def version():
true_flag('--deloriginals', help=delete_originals.__doc__)
true_flag('--debug', help='set logging to DEBUG')
true_flag('--no-init', dest='no_init', help='do not check directories for not yet optimized files')
true_flag('--no-watch', dest='no_watch', help='do not watch directories for changes')

parser.add_option('-d', '--dir', action="store", default=STORE_PATH, dest="store_path", help='the directory '
'within which internal storage resides')
Expand Down Expand Up @@ -77,7 +78,8 @@ def _main(opts, args):
# directories and then run the daemon afterwards
if not opts.no_init:
initialize(*args)
watch.watcher.run(*args)
if not opts.no_watch:
watch.watcher.run(*args)

def main():
try:
Expand Down
11 changes: 4 additions & 7 deletions imagy/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,18 @@ def test_watch(self):
valfun = lambda:(8, len(self.tmp.files()))
self.wait_until_passes(valfun, sleep=20)

def init(self):
# give time for imagy to start
self.copy_images_over()
self.start(starter=call)

def test_init_revert(self):
self.init()
self.copy_images_over()
self.start('--no-watch', starter=call)
valfun = lambda:(8, len(self.tmp.files()))
self.wait_until_passes(valfun)
self.start('-r', starter=call)
valfun = lambda:(4, len(self.tmp.files()))
self.wait_until_passes(valfun)

def test_del_originals(self):
self.init()
self.copy_images_over()
self.start('--no-watch', starter=call)
valfun = lambda:(8, len(self.tmp.files()))
self.wait_until_passes(valfun)
self.start('--deloriginals', starter=call)
Expand Down
2 changes: 0 additions & 2 deletions imagy/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ def on_created(self, event):
if not OPTIMIZE_ON_CREATE:
return
super(OptimizationHandler, self).on_created(event)
time.sleep(SECONDS_AFTER_CREATE)
self.handle_event(event)

def on_modified(self, event):
if not OPTIMIZE_ON_CHANGE:
return
super(OptimizationHandler, self).on_modified(event)
time.sleep(SECONDS_AFTER_CHANGE)
self.handle_event(event)

class Watcher(object):
Expand Down

0 comments on commit a026c24

Please sign in to comment.