Emulator

class privex.rpcemulator.base.Emulator(host='', port: int = 5000, background=True)[source]

This is the base class used by JsonRPC emulators such as privex.rpcemulator.bitcoin.BitcoinEmulator

It fires jsonrpcserver.serve() into the background using multiprocessing and handles shutting down the process either via context management (with statements), direct calls to terminate(), or when the object is garbage collected via __del__()

proc = None

Holds the multiprocessing.Process background process instance for serve()

quiet = True

Set Emulator.quiet = True to use quiet_serve() (disable HTTP request logging)

terminate()[source]

Called when a user wants to manually terminate the background process.

Simply calls __del__() to terminate the process.

use_coverage = True

When running unit tests, this should be set to True to load coverage in the subprocess

Methods

Methods

__init__([host, port, background])

Launch an RPC emulator web server.

terminate()

Called when a user wants to manually terminate the background process.

Attributes

Attributes

quiet

Set Emulator.quiet = True to use quiet_serve() (disable HTTP request logging)

use_coverage

When running unit tests, this should be set to True to load coverage in the subprocess