def mine(args): conf = fetch_config(args) app = BuildApp(conf) app.pool_size = 4 gh = get_connection(conf) pprint(mine_github_pulls(gh, app, conf))
def test_add_existing_app_object(self): self.assertEqual(self.app.queue, []) app = BuildApp() app.pool_size = 2 self.app.add(app) self.assertIs(app, self.app.queue[0]) self.assertIsNot(app, BuildApp()) self.assertIsNot(BuildApp(), self.app.queue[0])
def actions(args): conf = fetch_config(args) app = BuildApp(conf) app.pool_size = 4 gh = get_connection(conf) results = [] for pull in mine_github_pulls(gh, app, conf): if pull['merge_safe'] is True: results.append(pull) pprint(results)
def test_single_runner_app(self): self.assertEqual(self.app.queue, []) self.assertEqual(self.app.results, []) app = BuildApp() app.pool_size = 2 t = app.add('task') t.job = sum t.args = [[1, 2], 0] t.description = 'test task' self.app.add(app) self.app.run() self.assertEqual(self.app.results[0], 3)
def test_single_runner_app_with_many_subtasks(self): self.assertEqual(self.app.queue, []) self.assertEqual(self.app.results, []) app = BuildApp() app.pool_size = 2 for _ in range(10): t = app.add('task') t.job = sum t.description = 'test task' t.args = [[1, 2], 0] self.app.add(app) self.app.run() self.assertEqual(len(self.app.results), 10) self.assertEqual(self.app.results[0], 3) self.assertEqual(sum(self.app.results), 30)
def stats(args): conf = fetch_config(args) app = BuildApp(conf) app.pool_size = 4 gh = get_connection(conf) users = set() result = {'merge_safe': 0, 'total': 0} for pull in mine_github_pulls(gh, app, conf): result['total'] += 1 if pull['merge_safe'] is True: result['merge_safe'] += 1 users.add(pull['user']) result['user_count'] = len(users) result['users'] = list(users) pprint(result)