def run_on_all_enabled_modules(): """Run diagnostics on all the enabled modules and store the result.""" global current_results current_results = { 'apps': [], 'results': collections.OrderedDict(), 'progress_percentage': 0 } apps = [] for app in App.list(): # XXX: Implement more cleanly. # Don't run diagnostics on apps have not been setup yet. # However, run on apps that need an upgrade. module = importlib.import_module(app.__class__.__module__) if module.setup_helper.get_state() == 'needs-setup': continue if not app.is_enabled(): continue if not app.has_diagnostics(): continue apps.append((app.app_id, app)) current_results['results'][app.app_id] = None current_results['apps'] = apps for current_index, (app_id, app) in enumerate(apps): current_results['results'][app_id] = app.diagnose() current_results['progress_percentage'] = \ int((current_index + 1) * 100 / len(apps))
def test_app_list(): """Test listing all apps.""" app = AppTest() assert list(App.list()) == [app]