Example #1
0
    def setUp(self):
        self._loop = asyncio.get_event_loop()
        self._loop.set_debug(True)

        self._temp_path = tempfile.mkdtemp(prefix='nuclio-test-py-wrapper')

        # write handler to temp path
        self._handler_path = self._write_handler(self._temp_path)

        # set PYTHONPATH to include temp path
        sys.path.append(self._temp_path)

        # generate socket path
        self._socket_path = os.path.join(self._temp_path, 'nuclio.sock')

        # create transport
        self._unix_stream_server = self._create_unix_stream_server(self._socket_path)

        # create logger
        self._logger = nuclio_sdk.Logger(logging.DEBUG)
        self._logger.set_handler('test-default', sys.stdout, nuclio_sdk.logger.HumanReadableFormatter())

        self._platform_kind = 'test'
        self._default_test_handler = 'reverser:handler'

        # create a wrapper
        self._wrapper = wrapper.Wrapper(self._logger,
                                        self._loop,
                                        self._default_test_handler,
                                        self._socket_path,
                                        self._platform_kind,
                                        decode_event_strings=self._decode_event_strings)
        self._loop.run_until_complete(self._wrapper.initialize())
Example #2
0
    def setUp(self):
        self._temp_path = tempfile.mkdtemp(prefix='nuclio-test-py-wrapper')

        # write handler to temp path
        self._handler_path = self._write_handler(self._temp_path)

        # set PYTHONPATH to include temp path
        sys.path.append(self._temp_path)

        # generate socket path
        self._socket_path = os.path.join(self._temp_path, 'nuclio.sock')

        # create transport
        self._unix_stream_server = self._create_unix_stream_server(
            self._socket_path)

        # create logger
        self._logger = nuclio_sdk.Logger(logging.DEBUG)
        self._logger.set_handler('test-default', sys.stdout,
                                 nuclio_sdk.logger.HumanReadableFormatter())

        # create a wrapper
        self._wrapper = wrapper.Wrapper(self._logger, 'reverser:handler',
                                        self._socket_path, 'test')