def listdir(self, arg):
        """
        Fake os.listdir, depending on what mode we're in to simulate behaviour.

        @param arg: the directory to list
        """
        accurate = map(str, self._files)
        if self.procfs and arg == ('/proc/%d/fd' % (self.getpid(),)):
            return accurate
        if self.devfs and arg == '/dev/fd':
            if self.accurateDevFDResults:
                return accurate
            return ["0", "1", "2"]
        raise OSError()

        Fake os.listdir, depending on what mode we're in to simulate behaviour.

        @param arg: the directory to list
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_posixprocess.py