예제 #1
0
 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)
     )
예제 #2
0
    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")
예제 #3
0
    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")
예제 #4
0
 def test_explain(self):
     key = random.choice(list(Updates.UPDATES.keys()))
     self.assertEqual(
         Updates.UPDATES[key]['explanation'],
         Updates.explain(key)
     )
예제 #5
0
 def needed(self):
     return Updates.check_status(False)