| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
| Nobuaki Sukegawa | 64b8f6c | 2015-10-10 02:12:48 +0900 | [diff] [blame] | 2 | # -*- coding: utf-8 -*- |
| David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 3 | # |
| 4 | # Licensed to the Apache Software Foundation (ASF) under one |
| 5 | # or more contributor license agreements. See the NOTICE file |
| 6 | # distributed with this work for additional information |
| 7 | # regarding copyright ownership. The ASF licenses this file |
| 8 | # to you under the Apache License, Version 2.0 (the |
| 9 | # "License"); you may not use this file except in compliance |
| 10 | # with the License. You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, |
| 15 | # software distributed under the License is distributed on an |
| 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 17 | # KIND, either express or implied. See the License for the |
| 18 | # specific language governing permissions and limitations |
| 19 | # under the License. |
| 20 | # |
| 21 | |
| Jens Geyer | d629ea0 | 2015-09-23 21:16:50 +0200 | [diff] [blame] | 22 | import os |
| Dmytro Shteflyuk | 0b68228 | 2026-02-04 16:26:46 -0500 | [diff] [blame] | 23 | import ssl |
| Jens Geyer | d629ea0 | 2015-09-23 21:16:50 +0200 | [diff] [blame] | 24 | import sys |
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 25 | import time |
| Jens Geyer | d629ea0 | 2015-09-23 21:16:50 +0200 | [diff] [blame] | 26 | import unittest |
| Carel Combrink | a715bdf | 2025-10-30 07:44:21 +0100 | [diff] [blame] | 27 | import uuid |
| Mark Slee | 57cc25e | 2007-02-28 21:43:54 +0000 | [diff] [blame] | 28 | |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 29 | from optparse import OptionParser |
| Nobuaki Sukegawa | 7af189a | 2016-02-11 16:21:01 +0900 | [diff] [blame] | 30 | from util import local_libpath |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 31 | sys.path.insert(0, local_libpath()) |
| James E. King III | 9804ab9 | 2019-02-07 16:59:05 -0500 | [diff] [blame] | 32 | from thrift.protocol import TProtocol, TProtocolDecorator |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 33 | |
| Nobuaki Sukegawa | a185d7e | 2015-11-06 21:24:24 +0900 | [diff] [blame] | 34 | SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
| Roger Meier | f4eec7a | 2011-09-11 18:16:21 +0000 | [diff] [blame] | 35 | |
| Jens Geyer | d629ea0 | 2015-09-23 21:16:50 +0200 | [diff] [blame] | 36 | |
| Mark Slee | 5299a95 | 2007-10-05 00:13:24 +0000 | [diff] [blame] | 37 | class AbstractTest(unittest.TestCase): |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 38 | def setUp(self): |
| James E. King III | 6f8c99e | 2018-03-24 16:32:02 -0400 | [diff] [blame] | 39 | if options.trans == 'http': |
| 40 | uri = '{0}://{1}:{2}{3}'.format(('https' if options.ssl else 'http'), |
| 41 | options.host, |
| 42 | options.port, |
| 43 | (options.http_path if options.http_path else '/')) |
| 44 | if options.ssl: |
| Dmytro Shteflyuk | 0b68228 | 2026-02-04 16:26:46 -0500 | [diff] [blame] | 45 | __cafile = os.path.join(os.path.dirname(SCRIPT_DIR), "keys", "server.pem") |
| James E. King III | 6f8c99e | 2018-03-24 16:32:02 -0400 | [diff] [blame] | 46 | __certfile = os.path.join(os.path.dirname(SCRIPT_DIR), "keys", "client.crt") |
| 47 | __keyfile = os.path.join(os.path.dirname(SCRIPT_DIR), "keys", "client.key") |
| 48 | self.transport = THttpClient.THttpClient(uri, cafile=__cafile, cert_file=__certfile, key_file=__keyfile) |
| 49 | else: |
| 50 | self.transport = THttpClient.THttpClient(uri) |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 51 | else: |
| 52 | if options.ssl: |
| 53 | from thrift.transport import TSSLSocket |
| Dmytro Shteflyuk | 0b68228 | 2026-02-04 16:26:46 -0500 | [diff] [blame] | 54 | keys_dir = os.path.join(os.path.dirname(SCRIPT_DIR), "keys") |
| 55 | ca_certs = os.path.join(keys_dir, "server.pem") |
| 56 | certfile = os.path.join(keys_dir, "client.crt") |
| 57 | keyfile = os.path.join(keys_dir, "client.key") |
| 58 | ssl_version = getattr(ssl, "PROTOCOL_TLS_CLIENT", ssl.PROTOCOL_TLSv1) |
| 59 | socket = TSSLSocket.TSSLSocket( |
| 60 | options.host, |
| 61 | options.port, |
| 62 | certfile=certfile, |
| 63 | keyfile=keyfile, |
| 64 | ca_certs=ca_certs, |
| 65 | cert_reqs=ssl.CERT_REQUIRED, |
| 66 | ssl_version=ssl_version, |
| 67 | ) |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 68 | else: |
| Kengo Seki | f1c5341 | 2019-12-13 08:09:36 +0900 | [diff] [blame] | 69 | socket = TSocket.TSocket(options.host, options.port, options.domain_socket) |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 70 | # frame or buffer depending upon args |
| 71 | self.transport = TTransport.TBufferedTransport(socket) |
| 72 | if options.trans == 'framed': |
| 73 | self.transport = TTransport.TFramedTransport(socket) |
| 74 | elif options.trans == 'buffered': |
| 75 | self.transport = TTransport.TBufferedTransport(socket) |
| 76 | elif options.trans == '': |
| 77 | raise AssertionError('Unknown --transport option: %s' % options.trans) |
| 78 | if options.zlib: |
| 79 | self.transport = TZlibTransport.TZlibTransport(self.transport, 9) |
| 80 | self.transport.open() |
| 81 | protocol = self.get_protocol(self.transport) |
| 82 | self.client = ThriftTest.Client(protocol) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 83 | # for multiplexed services: |
| 84 | protocol2 = self.get_protocol2(self.transport) |
| 85 | self.client2 = SecondService.Client(protocol2) if protocol2 is not None else None |
| David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 86 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 87 | def tearDown(self): |
| 88 | self.transport.close() |
| Mark Slee | fc89d39 | 2006-09-04 00:04:39 +0000 | [diff] [blame] | 89 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 90 | def testVoid(self): |
| 91 | print('testVoid') |
| 92 | self.client.testVoid() |
| David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 93 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 94 | def testString(self): |
| 95 | print('testString') |
| 96 | self.assertEqual(self.client.testString('Python' * 20), 'Python' * 20) |
| 97 | self.assertEqual(self.client.testString(''), '') |
| 98 | s1 = u'\b\t\n/\\\\\r{}:パイソン"' |
| 99 | s2 = u"""Afrikaans, Alemannisch, Aragonés, العربية, مصرى, |
| Nobuaki Sukegawa | 64b8f6c | 2015-10-10 02:12:48 +0900 | [diff] [blame] | 100 | Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, |
| 101 | Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, |
| 102 | বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, |
| 103 | Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, |
| 104 | Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, |
| 105 | Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, |
| 106 | Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, |
| 107 | Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, |
| 108 | Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, |
| 109 | Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, |
| 110 | ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, |
| 111 | Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, |
| 112 | Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa |
| 113 | Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, مازِرونی, Bahasa |
| 114 | Melayu, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, |
| 115 | Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, |
| 116 | Occitan, Иронау, Papiamentu, Deitsch, Polski, پنجابی, پښتو, |
| 117 | Norfuk / Pitkern, Português, Runa Simi, Rumantsch, Romani, Română, |
| 118 | Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple |
| 119 | English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, |
| 120 | Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, |
| 121 | Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, |
| 122 | Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, |
| 123 | Bân-lâm-gú, 粵語""" |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 124 | self.assertEqual(self.client.testString(s1), s1) |
| 125 | self.assertEqual(self.client.testString(s2), s2) |
| Mark Slee | c967656 | 2006-09-05 17:34:52 +0000 | [diff] [blame] | 126 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 127 | def testMultiplexed(self): |
| 128 | if self.client2 is not None: |
| 129 | print('testMultiplexed') |
| 130 | self.assertEqual(self.client2.secondtestString('foobar'), 'testString("foobar")') |
| 131 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 132 | def testBool(self): |
| 133 | print('testBool') |
| 134 | self.assertEqual(self.client.testBool(True), True) |
| 135 | self.assertEqual(self.client.testBool(False), False) |
| Nobuaki Sukegawa | a649e74 | 2015-09-21 13:53:25 +0900 | [diff] [blame] | 136 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 137 | def testByte(self): |
| 138 | print('testByte') |
| 139 | self.assertEqual(self.client.testByte(63), 63) |
| 140 | self.assertEqual(self.client.testByte(-127), -127) |
| Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 141 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 142 | def testI32(self): |
| 143 | print('testI32') |
| 144 | self.assertEqual(self.client.testI32(-1), -1) |
| 145 | self.assertEqual(self.client.testI32(0), 0) |
| Mark Slee | c967656 | 2006-09-05 17:34:52 +0000 | [diff] [blame] | 146 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 147 | def testI64(self): |
| 148 | print('testI64') |
| 149 | self.assertEqual(self.client.testI64(1), 1) |
| 150 | self.assertEqual(self.client.testI64(-34359738368), -34359738368) |
| Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 151 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 152 | def testDouble(self): |
| 153 | print('testDouble') |
| 154 | self.assertEqual(self.client.testDouble(-5.235098235), -5.235098235) |
| 155 | self.assertEqual(self.client.testDouble(0), 0) |
| 156 | self.assertEqual(self.client.testDouble(-1), -1) |
| 157 | self.assertEqual(self.client.testDouble(-0.000341012439638598279), -0.000341012439638598279) |
| Mark Slee | c967656 | 2006-09-05 17:34:52 +0000 | [diff] [blame] | 158 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 159 | def testBinary(self): |
| 160 | print('testBinary') |
| 161 | val = bytearray([i for i in range(0, 256)]) |
| 162 | self.assertEqual(bytearray(self.client.testBinary(bytes(val))), val) |
| Jens Geyer | d629ea0 | 2015-09-23 21:16:50 +0200 | [diff] [blame] | 163 | |
| Carel Combrink | a715bdf | 2025-10-30 07:44:21 +0100 | [diff] [blame] | 164 | def testUuid(self): |
| 165 | print('testUuid') |
| 166 | val1 = uuid.UUID('00112233-4455-6677-8899-aabbccddeeff') |
| 167 | val2 = uuid.uuid4() |
| 168 | self.assertEqual(self.client.testUuid(val1), val1) |
| 169 | self.assertEqual(self.client.testUuid(val2), val2) |
| 170 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 171 | def testStruct(self): |
| 172 | print('testStruct') |
| 173 | x = Xtruct() |
| 174 | x.string_thing = "Zero" |
| 175 | x.byte_thing = 1 |
| 176 | x.i32_thing = -3 |
| 177 | x.i64_thing = -5 |
| 178 | y = self.client.testStruct(x) |
| 179 | self.assertEqual(y, x) |
| Mark Slee | fc89d39 | 2006-09-04 00:04:39 +0000 | [diff] [blame] | 180 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 181 | def testNest(self): |
| 182 | print('testNest') |
| 183 | inner = Xtruct(string_thing="Zero", byte_thing=1, i32_thing=-3, i64_thing=-5) |
| 184 | x = Xtruct2(struct_thing=inner, byte_thing=0, i32_thing=0) |
| 185 | y = self.client.testNest(x) |
| 186 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 187 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 188 | def testMap(self): |
| 189 | print('testMap') |
| 190 | x = {0: 1, 1: 2, 2: 3, 3: 4, -1: -2} |
| 191 | y = self.client.testMap(x) |
| 192 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 193 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 194 | def testSet(self): |
| 195 | print('testSet') |
| 196 | x = set([8, 1, 42]) |
| 197 | y = self.client.testSet(x) |
| 198 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 199 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 200 | def testList(self): |
| 201 | print('testList') |
| 202 | x = [1, 4, 9, -42] |
| 203 | y = self.client.testList(x) |
| 204 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 205 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 206 | def testEnum(self): |
| 207 | print('testEnum') |
| 208 | x = Numberz.FIVE |
| 209 | y = self.client.testEnum(x) |
| 210 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 211 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 212 | def testTypedef(self): |
| 213 | print('testTypedef') |
| 214 | x = 0xffffffffffffff # 7 bytes of 0xff |
| 215 | y = self.client.testTypedef(x) |
| 216 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 217 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 218 | def testMapMap(self): |
| 219 | print('testMapMap') |
| 220 | x = { |
| 221 | -4: {-4: -4, -3: -3, -2: -2, -1: -1}, |
| 222 | 4: {4: 4, 3: 3, 2: 2, 1: 1}, |
| 223 | } |
| 224 | y = self.client.testMapMap(42) |
| 225 | self.assertEqual(y, x) |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 226 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 227 | def testMulti(self): |
| 228 | print('testMulti') |
| 229 | xpected = Xtruct(string_thing='Hello2', byte_thing=74, i32_thing=0xff00ff, i64_thing=0xffffffffd0d0) |
| 230 | y = self.client.testMulti(xpected.byte_thing, |
| 231 | xpected.i32_thing, |
| 232 | xpected.i64_thing, |
| 233 | {0: 'abc'}, |
| 234 | Numberz.FIVE, |
| 235 | 0xf0f0f0) |
| 236 | self.assertEqual(y, xpected) |
| Mark Slee | c967656 | 2006-09-05 17:34:52 +0000 | [diff] [blame] | 237 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 238 | def testException(self): |
| 239 | print('testException') |
| 240 | self.client.testException('Safe') |
| 241 | try: |
| 242 | self.client.testException('Xception') |
| 243 | self.fail("should have gotten exception") |
| 244 | except Xception as x: |
| 245 | self.assertEqual(x.errorCode, 1001) |
| 246 | self.assertEqual(x.message, 'Xception') |
| 247 | # TODO ensure same behavior for repr within generated python variants |
| 248 | # ensure exception's repr method works |
| 249 | # x_repr = repr(x) |
| 250 | # self.assertEqual(x_repr, 'Xception(errorCode=1001, message=\'Xception\')') |
| Mark Slee | c967656 | 2006-09-05 17:34:52 +0000 | [diff] [blame] | 251 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 252 | try: |
| 253 | self.client.testException('TException') |
| 254 | self.fail("should have gotten exception") |
| Dmytro Shteflyuk | acbcf10 | 2026-02-13 18:25:55 -0500 | [diff] [blame] | 255 | except TException: |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 256 | pass |
| David Reiss | bcaa2ad | 2008-06-10 22:55:26 +0000 | [diff] [blame] | 257 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 258 | # Should not throw |
| 259 | self.client.testException('success') |
| Nobuaki Sukegawa | 01ede04 | 2015-09-29 02:16:53 +0900 | [diff] [blame] | 260 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 261 | def testMultiException(self): |
| 262 | print('testMultiException') |
| 263 | try: |
| 264 | self.client.testMultiException('Xception', 'ignore') |
| 265 | except Xception as ex: |
| 266 | self.assertEqual(ex.errorCode, 1001) |
| 267 | self.assertEqual(ex.message, 'This is an Xception') |
| Nobuaki Sukegawa | 01ede04 | 2015-09-29 02:16:53 +0900 | [diff] [blame] | 268 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 269 | try: |
| 270 | self.client.testMultiException('Xception2', 'ignore') |
| 271 | except Xception2 as ex: |
| 272 | self.assertEqual(ex.errorCode, 2002) |
| 273 | self.assertEqual(ex.struct_thing.string_thing, 'This is an Xception2') |
| Nobuaki Sukegawa | 01ede04 | 2015-09-29 02:16:53 +0900 | [diff] [blame] | 274 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 275 | y = self.client.testMultiException('success', 'foobar') |
| 276 | self.assertEqual(y.string_thing, 'foobar') |
| Nobuaki Sukegawa | 01ede04 | 2015-09-29 02:16:53 +0900 | [diff] [blame] | 277 | |
| Katie Atkinson | ff9850e | 2023-06-12 12:23:56 -0700 | [diff] [blame] | 278 | def testException__traceback__(self): |
| 279 | print('testException__traceback__') |
| 280 | self.client.testException('Safe') |
| 281 | expect_slots = uses_slots = False |
| 282 | expect_dynamic = uses_dynamic = False |
| 283 | try: |
| 284 | self.client.testException('Xception') |
| 285 | self.fail("should have gotten exception") |
| 286 | except Xception as x: |
| 287 | uses_slots = hasattr(x, '__slots__') |
| 288 | uses_dynamic = (not isinstance(x, TException)) |
| 289 | # We set expected values here so that we get clean tracebackes when |
| 290 | # the assertions fail. |
| 291 | try: |
| 292 | x.__traceback__ = x.__traceback__ |
| 293 | # If `__traceback__` was set without errors than we expect that |
| 294 | # the slots option was used and that dynamic classes were not. |
| 295 | expect_slots = True |
| 296 | expect_dynamic = False |
| 297 | except Exception as e: |
| 298 | self.assertTrue(isinstance(e, TypeError)) |
| 299 | # There are no other meaningful tests we can preform because we |
| 300 | # are unable to determine the desired state of either `__slots__` |
| 301 | # or `dynamic`. |
| 302 | return |
| 303 | |
| 304 | self.assertEqual(expect_slots, uses_slots) |
| 305 | self.assertEqual(expect_dynamic, uses_dynamic) |
| 306 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 307 | def testOneway(self): |
| 308 | print('testOneway') |
| 309 | start = time.time() |
| 310 | self.client.testOneway(1) # type is int, not float |
| 311 | end = time.time() |
| 312 | self.assertTrue(end - start < 3, |
| 313 | "oneway sleep took %f sec" % (end - start)) |
| Roger Meier | 7615072 | 2014-05-31 22:22:07 +0200 | [diff] [blame] | 314 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 315 | def testOnewayThenNormal(self): |
| 316 | print('testOnewayThenNormal') |
| 317 | self.client.testOneway(1) # type is int, not float |
| 318 | self.assertEqual(self.client.testString('Python'), 'Python') |
| David Reiss | db893b6 | 2008-02-18 02:11:48 +0000 | [diff] [blame] | 319 | |
| Roger Meier | 879cab2 | 2014-05-03 17:51:21 +0200 | [diff] [blame] | 320 | |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 321 | # LAST_SEQID is a global because we have one transport and multiple protocols |
| James E. King III | 9804ab9 | 2019-02-07 16:59:05 -0500 | [diff] [blame] | 322 | # running on it (when multiplexed) |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 323 | LAST_SEQID = None |
| 324 | |
| James E. King III | 3ec4031 | 2019-01-31 18:35:51 -0500 | [diff] [blame] | 325 | |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 326 | class TPedanticSequenceIdProtocolWrapper(TProtocolDecorator.TProtocolDecorator): |
| 327 | """ |
| 328 | Wraps any protocol with sequence ID checking: looks for outbound |
| 329 | uniqueness as well as request/response alignment. |
| 330 | """ |
| Dmytro Shteflyuk | acbcf10 | 2026-02-13 18:25:55 -0500 | [diff] [blame] | 331 | |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 332 | def __init__(self, protocol): |
| 333 | # TProtocolDecorator.__new__ does all the heavy lifting |
| 334 | pass |
| 335 | |
| 336 | def writeMessageBegin(self, name, type, seqid): |
| 337 | global LAST_SEQID |
| 338 | if LAST_SEQID and LAST_SEQID == seqid: |
| James E. King III | 3ec4031 | 2019-01-31 18:35:51 -0500 | [diff] [blame] | 339 | raise TProtocol.TProtocolException( |
| 340 | TProtocol.TProtocolException.INVALID_DATA, |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 341 | "Python client reused sequence ID {0}".format(seqid)) |
| 342 | LAST_SEQID = seqid |
| 343 | super(TPedanticSequenceIdProtocolWrapper, self).writeMessageBegin( |
| 344 | name, type, seqid) |
| 345 | |
| 346 | def readMessageBegin(self): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 347 | (name, type, seqid) =\ |
| 348 | super(TPedanticSequenceIdProtocolWrapper, self).readMessageBegin() |
| 349 | if LAST_SEQID != seqid: |
| James E. King III | 3ec4031 | 2019-01-31 18:35:51 -0500 | [diff] [blame] | 350 | raise TProtocol.TProtocolException( |
| 351 | TProtocol.TProtocolException.INVALID_DATA, |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 352 | "We sent seqid {0} and server returned seqid {1}".format( |
| 353 | self.last, seqid)) |
| 354 | return (name, type, seqid) |
| 355 | |
| 356 | |
| 357 | def make_pedantic(proto): |
| 358 | """ Wrap a protocol in the pedantic sequence ID wrapper. """ |
| 359 | return TPedanticSequenceIdProtocolWrapper(proto) |
| 360 | |
| James E. King III | 3ec4031 | 2019-01-31 18:35:51 -0500 | [diff] [blame] | 361 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 362 | class MultiplexedOptionalTest(AbstractTest): |
| 363 | def get_protocol2(self, transport): |
| 364 | return None |
| 365 | |
| 366 | |
| 367 | class BinaryTest(MultiplexedOptionalTest): |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 368 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 369 | return make_pedantic(TBinaryProtocol.TBinaryProtocolFactory().getProtocol(transport)) |
| Mark Slee | fc89d39 | 2006-09-04 00:04:39 +0000 | [diff] [blame] | 370 | |
| Nobuaki Sukegawa | 760511f | 2015-11-06 21:24:16 +0900 | [diff] [blame] | 371 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 372 | class MultiplexedBinaryTest(MultiplexedOptionalTest): |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 373 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 374 | wrapped_proto = make_pedantic(TBinaryProtocol.TBinaryProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 375 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") |
| 376 | |
| 377 | def get_protocol2(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 378 | wrapped_proto = make_pedantic(TBinaryProtocol.TBinaryProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 379 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "SecondService") |
| Bryan Duxbury | 59d4efd | 2011-03-21 17:38:22 +0000 | [diff] [blame] | 380 | |
| Nobuaki Sukegawa | 760511f | 2015-11-06 21:24:16 +0900 | [diff] [blame] | 381 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 382 | class AcceleratedBinaryTest(MultiplexedOptionalTest): |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 383 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 384 | return make_pedantic(TBinaryProtocol.TBinaryProtocolAcceleratedFactory(fallback=False).getProtocol(transport)) |
| Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 385 | |
| Nobuaki Sukegawa | 760511f | 2015-11-06 21:24:16 +0900 | [diff] [blame] | 386 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 387 | class MultiplexedAcceleratedBinaryTest(MultiplexedOptionalTest): |
| 388 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 389 | wrapped_proto = make_pedantic(TBinaryProtocol.TBinaryProtocolAcceleratedFactory(fallback=False).getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 390 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") |
| 391 | |
| 392 | def get_protocol2(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 393 | wrapped_proto = make_pedantic(TBinaryProtocol.TBinaryProtocolAcceleratedFactory(fallback=False).getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 394 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "SecondService") |
| 395 | |
| 396 | |
| 397 | class CompactTest(MultiplexedOptionalTest): |
| 398 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 399 | return make_pedantic(TCompactProtocol.TCompactProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 400 | |
| 401 | |
| 402 | class MultiplexedCompactTest(MultiplexedOptionalTest): |
| 403 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 404 | wrapped_proto = make_pedantic(TCompactProtocol.TCompactProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 405 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") |
| 406 | |
| 407 | def get_protocol2(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 408 | wrapped_proto = make_pedantic(TCompactProtocol.TCompactProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 409 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "SecondService") |
| 410 | |
| 411 | |
| 412 | class AcceleratedCompactTest(MultiplexedOptionalTest): |
| Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 413 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 414 | return make_pedantic(TCompactProtocol.TCompactProtocolAcceleratedFactory(fallback=False).getProtocol(transport)) |
| Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 415 | |
| 416 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 417 | class MultiplexedAcceleratedCompactTest(MultiplexedOptionalTest): |
| 418 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 419 | wrapped_proto = make_pedantic(TCompactProtocol.TCompactProtocolAcceleratedFactory(fallback=False).getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 420 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") |
| 421 | |
| 422 | def get_protocol2(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 423 | wrapped_proto = make_pedantic(TCompactProtocol.TCompactProtocolAcceleratedFactory(fallback=False).getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 424 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "SecondService") |
| 425 | |
| 426 | |
| 427 | class JSONTest(MultiplexedOptionalTest): |
| 428 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 429 | return make_pedantic(TJSONProtocol.TJSONProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 430 | |
| 431 | |
| 432 | class MultiplexedJSONTest(MultiplexedOptionalTest): |
| 433 | def get_protocol(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 434 | wrapped_proto = make_pedantic(TJSONProtocol.TJSONProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 435 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") |
| 436 | |
| 437 | def get_protocol2(self, transport): |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 438 | wrapped_proto = make_pedantic(TJSONProtocol.TJSONProtocolFactory().getProtocol(transport)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 439 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "SecondService") |
| 440 | |
| 441 | |
| Neil Williams | 66a44c5 | 2018-08-13 16:12:24 -0700 | [diff] [blame] | 442 | class HeaderTest(MultiplexedOptionalTest): |
| 443 | def get_protocol(self, transport): |
| 444 | factory = THeaderProtocol.THeaderProtocolFactory() |
| James E. King III | 84d9cd2 | 2019-01-31 11:47:58 -0500 | [diff] [blame] | 445 | return make_pedantic(factory.getProtocol(transport)) |
| Neil Williams | 66a44c5 | 2018-08-13 16:12:24 -0700 | [diff] [blame] | 446 | |
| 447 | |
| James E. King III | 9804ab9 | 2019-02-07 16:59:05 -0500 | [diff] [blame] | 448 | class MultiplexedHeaderTest(MultiplexedOptionalTest): |
| 449 | def get_protocol(self, transport): |
| 450 | wrapped_proto = make_pedantic(THeaderProtocol.THeaderProtocolFactory().getProtocol(transport)) |
| 451 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "ThriftTest") |
| 452 | |
| 453 | def get_protocol2(self, transport): |
| 454 | wrapped_proto = make_pedantic(THeaderProtocol.THeaderProtocolFactory().getProtocol(transport)) |
| 455 | return TMultiplexedProtocol.TMultiplexedProtocol(wrapped_proto, "SecondService") |
| 456 | |
| 457 | |
| David Reiss | 9ff3b9d | 2008-02-15 01:10:23 +0000 | [diff] [blame] | 458 | def suite(): |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 459 | suite = unittest.TestSuite() |
| 460 | loader = unittest.TestLoader() |
| 461 | if options.proto == 'binary': # look for --proto on cmdline |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 462 | suite.addTest(loader.loadTestsFromTestCase(BinaryTest)) |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 463 | elif options.proto == 'accel': |
| 464 | suite.addTest(loader.loadTestsFromTestCase(AcceleratedBinaryTest)) |
| Nobuaki Sukegawa | 6525f6a | 2016-02-11 13:58:39 +0900 | [diff] [blame] | 465 | elif options.proto == 'accelc': |
| 466 | suite.addTest(loader.loadTestsFromTestCase(AcceleratedCompactTest)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 467 | elif options.proto == 'compact': |
| 468 | suite.addTest(loader.loadTestsFromTestCase(CompactTest)) |
| Neil Williams | 66a44c5 | 2018-08-13 16:12:24 -0700 | [diff] [blame] | 469 | elif options.proto == 'header': |
| 470 | suite.addTest(loader.loadTestsFromTestCase(HeaderTest)) |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 471 | elif options.proto == 'json': |
| 472 | suite.addTest(loader.loadTestsFromTestCase(JSONTest)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 473 | elif options.proto == 'multi': |
| 474 | suite.addTest(loader.loadTestsFromTestCase(MultiplexedBinaryTest)) |
| 475 | elif options.proto == 'multia': |
| 476 | suite.addTest(loader.loadTestsFromTestCase(MultiplexedAcceleratedBinaryTest)) |
| 477 | elif options.proto == 'multiac': |
| 478 | suite.addTest(loader.loadTestsFromTestCase(MultiplexedAcceleratedCompactTest)) |
| 479 | elif options.proto == 'multic': |
| 480 | suite.addTest(loader.loadTestsFromTestCase(MultiplexedCompactTest)) |
| James E. King III | 9804ab9 | 2019-02-07 16:59:05 -0500 | [diff] [blame] | 481 | elif options.proto == 'multih': |
| 482 | suite.addTest(loader.loadTestsFromTestCase(MultiplexedHeaderTest)) |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 483 | elif options.proto == 'multij': |
| 484 | suite.addTest(loader.loadTestsFromTestCase(MultiplexedJSONTest)) |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 485 | else: |
| 486 | raise AssertionError('Unknown protocol given with --protocol: %s' % options.proto) |
| 487 | return suite |
| Mark Slee | 5299a95 | 2007-10-05 00:13:24 +0000 | [diff] [blame] | 488 | |
| Nobuaki Sukegawa | 760511f | 2015-11-06 21:24:16 +0900 | [diff] [blame] | 489 | |
| David Reiss | 7442127 | 2008-11-07 23:09:31 +0000 | [diff] [blame] | 490 | class OwnArgsTestProgram(unittest.TestProgram): |
| 491 | def parseArgs(self, argv): |
| 492 | if args: |
| 493 | self.testNames = args |
| 494 | else: |
| Nobuaki Sukegawa | a185d7e | 2015-11-06 21:24:24 +0900 | [diff] [blame] | 495 | self.testNames = ([self.defaultTest]) |
| David Reiss | 7442127 | 2008-11-07 23:09:31 +0000 | [diff] [blame] | 496 | self.createTests() |
| 497 | |
| James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 498 | |
| David Reiss | 9ff3b9d | 2008-02-15 01:10:23 +0000 | [diff] [blame] | 499 | if __name__ == "__main__": |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 500 | parser = OptionParser() |
| 501 | parser.add_option('--libpydir', type='string', dest='libpydir', |
| 502 | help='include this directory in sys.path for locating library code') |
| 503 | parser.add_option('--genpydir', type='string', dest='genpydir', |
| 504 | help='include this directory in sys.path for locating generated code') |
| 505 | parser.add_option("--port", type="int", dest="port", |
| 506 | help="connect to server at port") |
| 507 | parser.add_option("--host", type="string", dest="host", |
| 508 | help="connect to server") |
| 509 | parser.add_option("--zlib", action="store_true", dest="zlib", |
| 510 | help="use zlib wrapper for compressed transport") |
| 511 | parser.add_option("--ssl", action="store_true", dest="ssl", |
| 512 | help="use SSL for encrypted transport") |
| 513 | parser.add_option("--http", dest="http_path", |
| 514 | help="Use the HTTP transport with the specified path") |
| 515 | parser.add_option('-v', '--verbose', action="store_const", |
| 516 | dest="verbose", const=2, |
| 517 | help="verbose output") |
| 518 | parser.add_option('-q', '--quiet', action="store_const", |
| 519 | dest="verbose", const=0, |
| 520 | help="minimal output") |
| 521 | parser.add_option('--protocol', dest="proto", type="string", |
| James E. King III | 9804ab9 | 2019-02-07 16:59:05 -0500 | [diff] [blame] | 522 | help="protocol to use, one of: accel, accelc, binary, compact, header, json, multi, multia, multiac, multic, multih, multij") |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 523 | parser.add_option('--transport', dest="trans", type="string", |
| James E. King III | 6f8c99e | 2018-03-24 16:32:02 -0400 | [diff] [blame] | 524 | help="transport to use, one of: buffered, framed, http") |
| Kengo Seki | f1c5341 | 2019-12-13 08:09:36 +0900 | [diff] [blame] | 525 | parser.add_option('--domain-socket', dest="domain_socket", type="string", |
| 526 | help="Unix domain socket path") |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 527 | parser.set_defaults(framed=False, http_path=None, verbose=1, host='localhost', port=9090, proto='binary') |
| 528 | options, args = parser.parse_args() |
| Nobuaki Sukegawa | a185d7e | 2015-11-06 21:24:24 +0900 | [diff] [blame] | 529 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 530 | if options.genpydir: |
| 531 | sys.path.insert(0, os.path.join(SCRIPT_DIR, options.genpydir)) |
| Nobuaki Sukegawa | a185d7e | 2015-11-06 21:24:24 +0900 | [diff] [blame] | 532 | |
| James E. King III | 6f8c99e | 2018-03-24 16:32:02 -0400 | [diff] [blame] | 533 | if options.http_path: |
| 534 | options.trans = 'http' |
| 535 | |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 536 | from ThriftTest import SecondService |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 537 | from ThriftTest import ThriftTest |
| 538 | from ThriftTest.ttypes import Xtruct, Xtruct2, Numberz, Xception, Xception2 |
| 539 | from thrift.Thrift import TException |
| 540 | from thrift.transport import TTransport |
| 541 | from thrift.transport import TSocket |
| 542 | from thrift.transport import THttpClient |
| 543 | from thrift.transport import TZlibTransport |
| 544 | from thrift.protocol import TBinaryProtocol |
| 545 | from thrift.protocol import TCompactProtocol |
| Neil Williams | 66a44c5 | 2018-08-13 16:12:24 -0700 | [diff] [blame] | 546 | from thrift.protocol import THeaderProtocol |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 547 | from thrift.protocol import TJSONProtocol |
| James E. King III | 2068544 | 2018-04-10 10:30:51 -0400 | [diff] [blame] | 548 | from thrift.protocol import TMultiplexedProtocol |
| Nobuaki Sukegawa | a185d7e | 2015-11-06 21:24:24 +0900 | [diff] [blame] | 549 | |
| Nobuaki Sukegawa | 10308cb | 2016-02-03 01:57:03 +0900 | [diff] [blame] | 550 | OwnArgsTestProgram(defaultTest="suite", testRunner=unittest.TextTestRunner(verbosity=1)) |