# Path: pydoop/test_utils.py
# class WDTestCase(unittest.TestCase):
# 
#     def setUp(self):
#         self.wd = tempfile.mkdtemp(prefix='pydoop_test_')
# 
#     def tearDown(self):
#         shutil.rmtree(self.wd)
# 
#     def _mkfn(self, basename):
#         return os.path.join(self.wd, basename)
# 
#     def _mkf(self, basename, mode='w'):
#         return open(self._mkfn(basename), mode)


import io
import os
import unittest
import pydoop.mapreduce.api as api
import pydoop.mapreduce.binary_protocol as bp
import pydoop.mapreduce.pipes as pipes
import pydoop.sercore as sercore
from pydoop.test_utils import WDTestCase

    def __next__(self):
        cmd = self.stream.read_vint()
        if cmd == bp.AUTHENTICATION_RESP:
            return cmd, self.stream.read_tuple("b")
        elif cmd == bp.OUTPUT:
            return cmd, self.stream.read_tuple("bb")
        elif cmd == bp.PARTITIONED_OUTPUT:
            return cmd, self.stream.write_tuple("ibb")
        elif cmd == bp.STATUS:
            return cmd, self.stream.read_tuple("s")
        elif cmd == bp.PROGRESS:
            return cmd, self.stream.read_tuple("f")
        elif cmd == bp.REGISTER_COUNTER:
            return cmd, self.stream.read_tuple("iss")
        elif cmd == bp.INCREMENT_COUNTER:
            return cmd, self.stream.read_tuple("il")
        elif cmd == bp.DONE:
            raise StopIteration
        else:
            raise RuntimeError("unknown command: %d" % cmd)

    def __iter__(self):
        return self

    # py2 compat
    def next(self):
        return self.__next__()



# Path: pydoop/test_utils.py
# class WDTestCase(unittest.TestCase):
# 
#     def setUp(self):
#         self.wd = tempfile.mkdtemp(prefix='pydoop_test_')
# 
#     def tearDown(self):
#         shutil.rmtree(self.wd)
# 
#     def _mkfn(self, basename):
#         return os.path.join(self.wd, basename)
# 
#     def _mkf(self, basename, mode='w'):
#         return open(self._mkfn(basename), mode)


# Path: test/mapreduce/test_connections.py
import io
import os
import unittest
import pydoop.mapreduce.api as api
import pydoop.mapreduce.binary_protocol as bp
import pydoop.mapreduce.pipes as pipes
import pydoop.sercore as sercore
from pydoop.test_utils import WDTestCase


    def __next__(self):
        cmd = self.stream.read_vint()
        if cmd == bp.AUTHENTICATION_RESP:
            return cmd, self.stream.read_tuple("b")
        elif cmd == bp.OUTPUT:
            return cmd, self.stream.read_tuple("bb")
        elif cmd == bp.PARTITIONED_OUTPUT:
            return cmd, self.stream.write_tuple("ibb")
        elif cmd == bp.STATUS:
            return cmd, self.stream.read_tuple("s")
        elif cmd == bp.PROGRESS:
            return cmd, self.stream.read_tuple("f")
        elif cmd == bp.REGISTER_COUNTER:
            return cmd, self.stream.read_tuple("iss")
        elif cmd == bp.INCREMENT_COUNTER:
            return cmd, self.stream.read_tuple("il")
        elif cmd == bp.DONE:
            raise StopIteration
        else:
            raise RuntimeError("unknown command: %d" % cmd)

    def __iter__(self):
        return self

    # py2 compat
    def next(self):
        return self.__next__()



class TestFileConnection(WDTestCase):