

def test_netrc(self):
    (fd, t) = tempfile.mkstemp()
    try:
        try:
            address = self.server.server_address
            if isinstance(address, tuple):
                (address, port) = address
            else:
                port = self.server.server_port
            netrc = (b'machine 127.0.0.1:%s\n  login %s\n  password %s' % (port, API_KEY, API_PASSWORD))
            os.write(fd, netrc)
        finally:
            os.close(fd)
        client = self.getClient(key=None, password=None, netrcfile=t)
        client.get('/ping')
        self.assertMethod('GET')
        self.assertPath('/api/{0}/ping/'.format(client.version))
    finally:
        try:
            os.unlink(netrc)
        except:
            pass

dataset/ETHPy150Open smartfile/client-python/tests.py BasicClientTestCase.test_netrc/VarMisuse@166/224 `t`->`netrc`