Esempio n. 1
0
 def test_overlapping(self):
     res1 = testresources.TestResourceManager()
     res2 = testresources.TestResourceManager()
     resset1 = frozenset([res1])
     resset2 = frozenset([res2])
     resset3 = frozenset([res1, res2])
     resource_sets = [resset1, resset2, resset3]
     result = _resource_graph(resource_sets)
     self.assertEqual(
         {resset1:set([resset3]),
          resset2:set([resset3]),
          resset3:set([resset1, resset2])},
         result)
 def testSortingTwelveOverlappingIsFast(self):
     # Given twelve connected resource sets, my patience is not exhausted.
     managers = []
     for pos in range(12):
         managers.append(testresources.TestResourceManager())
     # Add more sample tests
     cases = [self.case1, self.case2, self.case3, self.case4]
     for pos in range(5, 13):
         cases.append(
             testtools.clone_test_with_new_id(cases[0], 'case%d' % pos))
     tempdir = testresources.TestResourceManager()
     # give all tests a tempdir, enough to provoke a single partition in
     # the current code.
     for case, manager in zip(cases, managers):
         case.resources = [('_resource', manager), ('tempdir', tempdir)]
 def testSortingTwelveIndependentIsFast(self):
     # Given twelve independent resource sets, my patience is not exhausted.
     managers = []
     for pos in range(12):
         managers.append(testresources.TestResourceManager())
     # Add more sample tests
     cases = [self.case1, self.case2, self.case3, self.case4]
     for pos in range(5, 13):
         cases.append(
             testtools.clone_test_with_new_id(cases[0], 'case%d' % pos))
     # We care that this is fast in this test, so we don't need to have
     # overlapping resource usage
     for case, manager in zip(cases, managers):
         case.resources = [('_resource', manager)]
Esempio n. 4
0
 def test_discrete(self):
     resset1 = frozenset([testresources.TestResourceManager()])
     resset2 = frozenset([testresources.TestResourceManager()])
     resource_sets = [resset1, resset2]
     result = _resource_graph(resource_sets)
     self.assertEqual({resset1:set([]), resset2:set([])}, result)