def test_set_updates_clean_install(self): self.assertFalse('updates' in config.p) self.assertFalse(Updates.check_status()) self.assertEqual( len(config.p['updates']), len(Updates.UPDATES) )
def update(self, confirm=True): updates_needed = self.needed() if updates_needed: print("\nThe following updates will be applied:\n") for update in updates_needed: print(Updates.explain(update)) if confirm: confirmation = input("\nType 'y'to confirm, anything else to cancel: ") if confirmation.strip() != "y": print("\n*** Upgrade canceled ***\n") sys.exit(0) for update in updates_needed: Updates.do_update(update) else: print("\n*** Brightway2 is up to date! ***\n")
def list(self): updates_needed = self.needed() if not updates_needed: print("\n*** Brightway2 is up to date! ***\n") else: print("\n*** Updates found ***") for update in updates_needed: print(Updates.explain(update)) print("\n*** Action needed ***\nPlease run bw2-uptodate\n")
def test_explain(self): key = random.choice(list(Updates.UPDATES.keys())) self.assertEqual( Updates.UPDATES[key]['explanation'], Updates.explain(key) )
def needed(self): return Updates.check_status(False)