Reuse a single TaskScheduler instance.
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 01:42:06 +0000 (18:42 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 01:42:06 +0000 (18:42 -0700)
pym/portage/tests/ebuild/test_doebuild_spawn.py

index 76d114ddf3492bdff991539271ff0e77dbc3d139..32123e2790e0cb584cba4db64072e7398a31ed31 100644 (file)
@@ -51,13 +51,14 @@ class DoebuildSpawnTestCase(TestCase):
                        # Create a fake environment, to pretend as if the ebuild
                        # has been sourced already.
                        open(os.path.join(settings['T'], 'environment'), 'wb')
+
+                       task_scheduler = TaskScheduler()
                        for phase in ('_internal_test',):
                                rval = doebuild_spawn(
                                        "%s %s" % (_shell_quote(EBUILD_SH_BINARY), phase),
                                        settings, free=1)
                                self.assertEqual(rval, os.EX_OK)
 
-                               task_scheduler = TaskScheduler()
                                ebuild_phase = EbuildPhase(background=False,
                                        phase=phase, scheduler=task_scheduler.sched_iface,
                                        settings=settings)
@@ -65,7 +66,6 @@ class DoebuildSpawnTestCase(TestCase):
                                task_scheduler.run()
                                self.assertEqual(ebuild_phase.returncode, os.EX_OK)
 
-                       task_scheduler = TaskScheduler()
                        ebuild_phase = MiscFunctionsProcess(background=False,
                                commands=['success_hooks'],
                                scheduler=task_scheduler.sched_iface, settings=settings)