old_contents: from disco.test import DiscoJobTestFixture, DiscoTestCase
  
  class LocalhostTestCase(DiscoJobTestFixture, DiscoTestCase):
      @property
      def inputs(self):
          return range(self.num_workers * 2)
  
      def getdata(self, path):
          return path
  
      @staticmethod
      def map(e, params):
          time.sleep(0.5)
          return [(int(e), '')]
  
      def setUp(self):
          self.config = self.disco.config
          nodenames   = set(name for name, workers in self.config)
          self.disco.config = [['localhost', '1']]
          super(LocalhostTestCase, self).setUp()
  
      def runTest(self):
          self.assertEquals(sum(xrange(self.num_workers * 2)),
                    sum(int(k) for k, v in self.results))
  
      def tearDown(self):
          super(LocalhostTestCase, self).tearDown()
          self.disco.config = self.config
  
new_contents: from disco.test import TestCase, TestJob
  
  class LocalhostJob(TestJob):
      @staticmethod
      def map(e, params):
          import time
          time.sleep(0.5)
          yield int(e), ''
  
  class LocalhostTestCase(TestCase):
      def serve(self, path):
          return path
  
      def setUp(self):
          self.config = self.disco.config
          nodenames   = set(name for name, workers in self.config)
          self.disco.config = [['localhost', '1']]
          super(LocalhostTestCase, self).setUp()
  
      def runTest(self):
          X = xrange(self.num_workers * 2)
          self.job = LocalhostJob().run(input=self.test_server.urls(X))
          self.assertEqual(sum(k for k, v in self.results(self.job)), sum(X))
  
      def tearDown(self):
          super(LocalhostTestCase, self).tearDown()
          self.disco.config = self.config
  
subject: convert test_localhost