Пример #1
0
    def run(self):
        from gevent import monkey
        monkey.patch_all()

        import tests

        import grpc.experimental.gevent
        grpc.experimental.gevent.init_gevent()

        import gevent

        import tests
        loader = tests.Loader()
        loader.loadTestsFromNames(['tests', 'tests_gevent'])
        runner = tests.Runner()
        if sys.platform == 'win32':
            runner.skip_tests(self.BANNED_TESTS + self.BANNED_WINDOWS_TESTS)
        elif sys.platform == 'darwin':
            runner.skip_tests(self.BANNED_TESTS + self.BANNED_MACOS_TESTS)
        else:
            runner.skip_tests(self.BANNED_TESTS)
        result = gevent.spawn(runner.run, loader.suite)
        result.join()
        if not result.value.wasSuccessful():
            sys.exit('Test failure')
Пример #2
0
 def run(self):
     self._add_eggs_to_path()
     import tests
     loader = tests.Loader()
     loader.loadTestsFromNames(['tests_py3_only'])
     runner = tests.Runner()
     result = runner.run(loader.suite)
     if not result.wasSuccessful():
         sys.exit('Test failure')
Пример #3
0
  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_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))

    with open('src/python/grpcio/tests/tests.json') as tests_json_file:
      tests_json = json.load(tests_json_file)
    self.assertListEqual(test_suite_names, tests_json)
Пример #4
0
    def run(self):
        self._add_eggs_to_path()

        import tests
        loader = tests.Loader()
        loader.loadTestsFromNames(['tests_aio'])
        # Even without dedicated threads, the framework will somehow spawn a
        # new thread for tests to run upon. New thread doesn't have event loop
        # attached by default, so initialization is needed.
        runner = tests.Runner(dedicated_threads=False)
        result = runner.run(loader.suite)
        if not result.wasSuccessful():
            sys.exit('Test failure')
Пример #5
0
  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_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)
Пример #6
0
    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 = sorted({
            test_case_class.id().rsplit('.', 1)[0]
            for test_case_class in tests._loader.iterate_suite_cases(
                loader.suite)
        })

        tests_json_string = pkgutil.get_data('tests', 'tests.json')
        tests_json = json.loads(
            tests_json_string.decode() if six.PY3 else tests_json_string)

        self.assertSequenceEqual(tests_json, test_suite_names)
Пример #7
0
    def run(self):
        from gevent import monkey
        monkey.patch_all()

        import tests

        import grpc.experimental.gevent
        grpc.experimental.gevent.init_gevent()

        import gevent

        import tests
        loader = tests.Loader()
        loader.loadTestsFromNames(['tests'])
        runner = tests.Runner()
        runner.skip_tests(self.BANNED_TESTS)
        result = gevent.spawn(runner.run, loader.suite)
        result.join()
        if not result.value.wasSuccessful():
            sys.exit('Test failure')
Пример #8
0
    def run(self):
        import gevent
        from gevent import monkey
        monkey.patch_all()

        threadpool = gevent.hub.get_hub().threadpool

        # Currently, each channel corresponds to a single native thread in the
        # gevent threadpool. Thus, when the unit test suite spins up hundreds of
        # channels concurrently, some will be starved out, causing the test to
        # increase in duration. We increase the max size here so this does not
        # happen.
        threadpool.maxsize = 1024
        threadpool.size = 32

        import grpc.experimental.gevent

        import tests
        grpc.experimental.gevent.init_gevent()

        import gevent

        import tests
        loader = tests.Loader()
        loader.loadTestsFromNames(['tests', 'tests_gevent'])
        runner = tests.Runner()
        if sys.platform == 'win32':
            runner.skip_tests(self.BANNED_TESTS + self.BANNED_WINDOWS_TESTS)
        elif sys.platform == 'darwin':
            runner.skip_tests(self.BANNED_TESTS + self.BANNED_MACOS_TESTS)
        else:
            runner.skip_tests(self.BANNED_TESTS)
        result = gevent.spawn(runner.run, loader.suite)
        result.join()
        if not result.value.wasSuccessful():
            sys.exit('Test failure')