1 # -*- coding: utf-8 -*-
6 from ..controllers.main import module_topological_sort as sort
8 def sample(population):
11 random.randint(0, min(len(population), 5)))
13 class TestModulesLoading(unittest2.TestCase):
15 self.mods = map(str, range(1000))
16 def test_topological_sort(self):
17 random.shuffle(self.mods)
19 (k, sample(self.mods[:i]))
20 for i, k in enumerate(self.mods)]
21 random.shuffle(modules)
25 sorted_modules = sort(ms)
26 for module in sorted_modules:
28 self.assertGreaterEqual(
30 'Module %s (index %d), ' \
31 'missing dependencies %s from loaded modules %s' % (
32 module, sorted_modules.index(module), deps, seen