Public Member Functions | List of all members
grpc_testing.Time Class Reference
Inheritance diagram for grpc_testing.Time:
Inheritance graph
[legend]

Public Member Functions

def call_at (self, behavior, time)
 
def call_in (self, behavior, delay)
 
def sleep_for (self, duration)
 
def sleep_until (self, time)
 
def time (self)
 

Detailed Description

A simulation of time.

Implementations needn't be connected with real time as provided by the
Python interpreter, but as long as systems under test use
RpcContext.is_active and RpcContext.time_remaining for querying RPC liveness
implementations may be used to change passage of time in tests.

Definition at line 567 of file src/python/grpcio_testing/grpc_testing/__init__.py.

Member Function Documentation

◆ call_at()

def grpc_testing.Time.call_at (   self,
  behavior,
  time 
)
Adds a behavior to be called at a specific time.

Args:
  behavior: A behavior to be called with no arguments.
  time: The test time at which to call the behavior.

Returns:
  A grpc.Future with which the call of the behavior may be cancelled
    before it is executed.

Reimplemented in grpc_testing._time.StrictFakeTime, and grpc_testing._time.StrictRealTime.

Definition at line 600 of file src/python/grpcio_testing/grpc_testing/__init__.py.

◆ call_in()

def grpc_testing.Time.call_in (   self,
  behavior,
  delay 
)
Adds a behavior to be called after some time.

Args:
  behavior: A behavior to be called with no arguments.
  delay: A duration of time in seconds after which to call the behavior.

Returns:
  A grpc.Future with which the call of the behavior may be cancelled
    before it is executed.

Reimplemented in grpc_testing._time.StrictFakeTime, and grpc_testing._time.StrictRealTime.

Definition at line 586 of file src/python/grpcio_testing/grpc_testing/__init__.py.

◆ sleep_for()

def grpc_testing.Time.sleep_for (   self,
  duration 
)
Blocks for some length of test time.

Args:
  duration: A duration of test time in seconds for which to block.

Reimplemented in grpc_testing._time.StrictFakeTime, and grpc_testing._time.StrictRealTime.

Definition at line 614 of file src/python/grpcio_testing/grpc_testing/__init__.py.

◆ sleep_until()

def grpc_testing.Time.sleep_until (   self,
  time 
)
Blocks until some test time.

Args:
  time: The test time until which to block.

Reimplemented in grpc_testing._time.StrictFakeTime, and grpc_testing._time.StrictRealTime.

Definition at line 623 of file src/python/grpcio_testing/grpc_testing/__init__.py.

◆ time()

def grpc_testing.Time.time (   self)
Accesses the current test time.

Returns:
  The current test time (over which this object has authority).

Reimplemented in grpc_testing._time.StrictFakeTime, and grpc_testing._time.StrictRealTime.

Definition at line 577 of file src/python/grpcio_testing/grpc_testing/__init__.py.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:40