def run_check(pk): """ The central job to run the check. Called after a check has been created. """ check = Check.objects.get(pk=pk) check.started_at = now() all_py3_projects = get_or_fetch_all_py3_projects() blockers = blocking_dependencies(check.projects, all_py3_projects) blockers_mapping = {} for blocker in sorted(blockers, key=lambda x: tuple(reversed(x))): blockers_mapping[blocker[0]] = blocker[1:] check.blockers = blockers_mapping flattened_blockers = set() for blocker_reasons in blockers: for blocker in blocker_reasons: flattened_blockers.add(blocker) check.unblocked = len(flattened_blockers) check.finished_at = now() check.save() redis = get_redis() redis.set(CHECKED_COUNT_KEY, Check.objects.count()) return blockers
def check(projects): """Check the specified projects for Python 3 compatibility.""" log = logging.getLogger('ciu') log.info('{0} top-level projects to check'.format(len(projects))) print('Finding and checking dependencies ...') blockers = ciu.blocking_dependencies(projects, ciu.all_py3_projects()) print('') for line in message(blockers): print(line) print('') for line in pprint_blockers(blockers): print(' ', line)
def test_blocking_dependencies(self): got = ciu.blocking_dependencies(['unittest2'], {}) want = set([('unittest2',)]) self.assertEqual(got, want)
def test_blocking_dependencies(self): got = ciu.blocking_dependencies(['unittest2'], {}) want = set([('unittest2', )]) self.assertEqual(got, want)