def __init__(self, host, port, timeoutSeconds=180):
self._mock_intent = distutils.util.strtobool(
os.getenv("MYRA_MOCK_PREDICT_INTENT", "0"))
if self._mock_intent:
return
self.host = host
self.port = port
self.session = requests.session()
self.server = "http://%s:%s" % (host, port)
self.timeoutSeconds = timeoutSeconds
python类util()的实例源码
def setUp(self):
super(StubsTest, self).setUp()
self.platform = sys.platform
self.mox = mox.Mox()
self.mox.StubOutWithMock(locale, 'setlocale')
self.mox.StubOutWithMock(util, 'get_platform')
self.mox.StubOutWithMock(stubs.FakeFile, 'is_file_accessible')