MCPcopy Create free account
hub / github.com/FDio/vpp / run

Method run

test/remote_test.py:322–356  ·  view source on GitHub ↗

Create instance of the wrapped class and execute operations on it as requested by the parent process.

(self)

Source from the content-addressed store, hash-verified

320 self._timeout = timeout
321
322 def run(self):
323 """
324 Create instance of the wrapped class and execute operations
325 on it as requested by the parent process.
326 """
327 self._instance = self._cls(*self._args, **self._kwargs)
328 while True:
329 try:
330 rv = None
331 # get request from the parent process
332 op, path, args, kwargs = self._pipe[RemoteClass.PIPE_CHILD].recv()
333 args = self._deserialize(args)
334 kwargs = self._deserialize(kwargs)
335 path = path.split(".") if path else []
336 if op == RemoteClass.GET:
337 rv = self._get_local_value(path)
338 elif op == RemoteClass.CALL:
339 rv = self._call_local_method(path, *args, **kwargs)
340 elif op == RemoteClass.SETATTR and "value" in kwargs:
341 self._set_local_attr(path, kwargs["value"])
342 elif op == RemoteClass.REPR:
343 rv = self._get_local_repr(path)
344 elif op == RemoteClass.STR:
345 rv = self._get_local_str(path)
346 elif op == RemoteClass.QUIT:
347 break
348 else:
349 continue
350 # send return value
351 if not self._serializable(rv):
352 rv = self._make_serializable(rv)
353 self._pipe[RemoteClass.PIPE_CHILD].send(rv)
354 except EOFError:
355 break
356 self._instance = None # destroy the instance
357
358
359@unittest.skip("Remote Vpp Test Case Class")

Callers

nothing calls this directly

Calls 10

_deserializeMethod · 0.95
_get_local_valueMethod · 0.95
_call_local_methodMethod · 0.95
_set_local_attrMethod · 0.95
_get_local_reprMethod · 0.95
_get_local_strMethod · 0.95
_serializableMethod · 0.95
_make_serializableMethod · 0.95
recvMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected