示例#1
0
    def test_bserInput(self):
        sockname = self.getSockPath()
        watchman_cmd = bser.dumps(['get-sockname'])
        cli_cmd = [
            'watchman',
            '--sockname={0}'.format(sockname),
            '--logfile=/BOGUS',
            '--statefile=/BOGUS',
            '--no-spawn',
            '--no-local',
            '-j',
        ]
        proc = subprocess.Popen(cli_cmd,
                                stdin=subprocess.PIPE,
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE)

        stdout, stderr = proc.communicate(input=watchman_cmd)
        self.assertEqual(proc.poll(), 0, stderr)
        # the response should be bser to match our input
        result = bser.loads(stdout)
        result_sockname = result['sockname']
        if compat.PYTHON3:
            result_sockname = encoding.decode_local(result_sockname)
        self.assertEqual(result_sockname, sockname,
                         binascii.hexlify(stdout).decode('ascii'))
示例#2
0
    def test_bserInput(self):
        sockpath = self.getSockPath()
        watchman_cmd = bser.dumps(["get-sockname"])
        cli_cmd = [
            os.environ.get("WATCHMAN_BINARY", "watchman"),
            "--unix-listener-path={0}".format(sockpath.unix_domain),
            "--named-pipe-path={0}".format(sockpath.named_pipe),
            "--logfile=/BOGUS",
            "--statefile=/BOGUS",
            "--no-spawn",
            "--no-local",
            "-j",
        ]
        proc = subprocess.Popen(
            cli_cmd,
            stdin=subprocess.PIPE,
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE,
        )

        stdout, stderr = proc.communicate(input=watchman_cmd)
        self.assertEqual(proc.poll(), 0, stderr)
        # the response should be bser to match our input
        result = bser.loads(stdout)
        result_sockname = result["unix_domain"]
        if compat.PYTHON3:
            result_sockname = encoding.decode_local(result_sockname)
        self.assertEqual(
            result_sockname,
            sockpath.unix_domain,
            binascii.hexlify(stdout).decode("ascii"),
        )
示例#3
0
    def test_bserInput(self):
        sockname = self.getSockPath()
        watchman_cmd = bser.dumps(["get-sockname"])
        cli_cmd = [
            "watchman",
            "--sockname={0}".format(sockname),
            "--logfile=/BOGUS",
            "--statefile=/BOGUS",
            "--no-spawn",
            "--no-local",
            "-j",
        ]
        proc = subprocess.Popen(
            cli_cmd,
            stdin=subprocess.PIPE,
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE,
        )

        stdout, stderr = proc.communicate(input=watchman_cmd)
        self.assertEqual(proc.poll(), 0, stderr)
        # the response should be bser to match our input
        result = bser.loads(stdout)
        result_sockname = result["sockname"]
        if compat.PYTHON3:
            result_sockname = encoding.decode_local(result_sockname)
        self.assertEqual(result_sockname, sockname,
                         binascii.hexlify(stdout).decode("ascii"))