Merge pull request #12603 from nathanielmanistaatgoogle/python_sanity_test

Tweak Python sanity test.
pull/12606/head
Nathaniel Manista 7 years ago committed by GitHub
commit c4add66ebd
  1. 0
      src/python/grpcio_tests/tests/_sanity/__init__.py
  2. 17
      src/python/grpcio_tests/tests/_sanity/_sanity_test.py
  3. 2
      src/python/grpcio_tests/tests/tests.json

@ -21,24 +21,25 @@ import six
import tests
class Sanity(unittest.TestCase):
class SanityTest(unittest.TestCase):
maxDiff = 32768
def testTestsJsonUpToDate(self):
"""Autodiscovers all test suites and checks that tests.json is up to date"""
loader = tests.Loader()
loader.loadTestsFromNames(['tests'])
test_suite_names = [
test_suite_names = sorted({
test_case_class.id().rsplit('.', 1)[0]
for test_case_class in tests._loader.iterate_suite_cases(
loader.suite)
]
test_suite_names = sorted(set(test_suite_names))
})
tests_json_string = pkg_resources.resource_string('tests', 'tests.json')
if six.PY3:
tests_json_string = tests_json_string.decode()
tests_json = json.loads(tests_json_string)
self.assertListEqual(test_suite_names, tests_json)
tests_json = json.loads(tests_json_string.decode()
if six.PY3 else tests_json_string)
self.assertSequenceEqual(tests_json, test_suite_names)
if __name__ == '__main__':

@ -1,4 +1,5 @@
[
"_sanity._sanity_test.SanityTest",
"health_check._health_servicer_test.HealthServicerTest",
"interop._insecure_intraop_test.InsecureIntraopTest",
"interop._secure_intraop_test.SecureIntraopTest",
@ -41,7 +42,6 @@
"unit._reconnect_test.ReconnectTest",
"unit._resource_exhausted_test.ResourceExhaustedTest",
"unit._rpc_test.RPCTest",
"unit._sanity._sanity_test.Sanity",
"unit._thread_cleanup_test.CleanupThreadTest",
"unit.beta._beta_features_test.BetaFeaturesTest",
"unit.beta._beta_features_test.ContextManagementAndLifecycleTest",

Loading…
Cancel
Save