def testDoubleMigrate(self): choices.migrate('Edit', 'rox.sourceforge.net') try: choices.migrate('Edit', 'rox.sourceforge.net') raise Exception('Expected exception!') except AssertionError: pass
def testMigrateNothing(self): choices.migrate('Edit', 'rox.sourceforge.net') choices.load('Draw', 'Options') try: choices.load('Edit', 'Options') raise Exception('Expected exception!') except AssertionError: pass assert not os.path.exists('/tmp/config')
def testMigrateNormal(self): save = choices.save('Edit', 'Options') self.assertEquals(save, '/tmp/choices/Edit/Options') file(save, 'w').close() choices.migrate('Edit', 'rox.sourceforge.net') assert os.path.isfile( '/tmp/config/rox.sourceforge.net/Edit/Options') assert os.path.islink('/tmp/choices/Edit') assert os.path.isfile('/tmp/choices/Edit/Options')
def testFailedMigration(self): save = choices.save('Edit', 'Options') file(save, 'w').close() save2 = basedir.save_config_path('rox.sourceforge.net', 'Edit') file(os.path.join(save2, 'Options'), 'w').close() old, sys.stderr = sys.stderr, null try: choices.migrate('Edit', 'rox.sourceforge.net') finally: sys.stderr = old assert os.path.isdir('/tmp/choices/Edit') assert os.path.isdir('/tmp/config/rox.sourceforge.net/Edit')
hbox.pack_start(eb, True, True, 0) hbox.pack_start(clearbutton, False, True, 0) self.handlers[option] = (lambda: filebutton.get_filename(), lambda: filebutton.set_filename(option.value)) filebutton.connect('selection-changed', lambda w: self.check_widget(option)) clearbutton.connect('clicked', lambda w: filebutton.set_filename("")) return [hbox] else: # Fallback to text input return self.build_entry(node, label, option) OptionsBox.widget_registry['filechooser'] = build_filechooser choices.migrate('Memo', 'rox.sourceforge.net') import os, __builtin__ __builtin__._ = rox.i18n.translation(os.path.join(rox.app_dir, 'Messages')) rox.setup_app_options('Memo', site='rox.sourceforge.net') from rox.Menu import set_save_name set_save_name('Memo', site='rox.sourceforge.net') import Window, memos, clock try: # Need this for the Systray options import Systray except AssertionError: pass