No project description provided
Project description
UtBot Executor
Util for python code execution and state serialization.
Installation
You can install module from PyPI:
python -m pip install utbot-executor
Usage
From console with socket listener
Run with your <hostname>
and <port>
for socket connection
$ python -m utbot_executor <hostname> <port> <logfile> [<loglevel DEBUG | INFO | ERROR>] <coverage_hostname> <coverage_port>
Request format
{
"functionName": "f",
"functionModule": "my_module.submod1",
"imports": ["sys", "math", "json"],
"syspaths": ["/home/user/my_project/"],
"argumentsIds": ["1", "2"],
"kwargumentsIds": ["4", "5"],
"serializedMemory": "string",
"memoryMode": "REDUCE",
"filepath": ["/home/user/my_project/my_module/submod1.py"],
"coverageId": "1"
}
functionName
- name of the tested functionfunctionModule
- name of the module of the tested functionimports
- all modules which need to run function with current argumentssyspaths
- all syspaths which need to import modules (usually it is a project root)argumentsIds
- list of argument's idskwargumentsIds
- list of keyword argument's idsserializedMemory
- serialized memory throwdeep_serialization
algorithmmemoryMode
- serialization mode (PICKLE
,REDUCE
)filepath
- path to the tested function's containing filecoverageId
- special id witch will be used for sending information about covered lines
Response format:
If execution is successful:
{
"status": "success",
"isException": false,
"statements": [1, 2, 3],
"missedStatements": [4, 5],
"stateInit": "string",
"stateBefore": "string",
"stateAfter": "string",
"diffIds": ["3", "4"],
"argsIds": ["1", "2", "3"],
"kwargs": ["4", "5", "6"],
"resultId": "7"
}
status
- always "success"isException
- boolean value, if it istrue
, execution ended with an exceptionstatements
- list of the numbers of covered rowsmissedStatements
- list of numbers of uncovered rowsstateInit
- serialized states from requeststateBefore
- serialized states of arguments before executionstateAfter
- serialized states of arguments after executiondiffIds
- ids of the objects which have been changedargsIds
- ids of the function's argumentskwargsIds
- ids of the function's keyword argumentsresultId
- id of the returned value
or error format if there was exception in running algorith:
{
"status": "fail",
"exception": "stacktrace"
}
status
- always "fail"exception
- string representation of the exception stack trace
Submodule deep_serialization
JSON serializer and deserializer for python objects
States memory json-format
{
"objects": {
"id": {
"id": "1",
"strategy": "strategy name",
"typeinfo": {
"module": "builtins",
"kind": "int"
},
"comparable": true,
// iff strategy is 'repr'
"value": "1",
// iff strategy is 'list' or 'dict'
"items": ["3", "2"],
// iff strategy = 'reduce'
"constructor": "mymod.A.__new__",
"args": ["mymod.A"],
"state": {"a": "4", "b": "5"},
"listitems": ["7", "8"],
"dictitems": {"ka": "10"}
}
}
}
Source
GitHub repository
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
utbot_executor-1.9.13.tar.gz
(19.0 kB
view hashes)
Built Distribution
Close
Hashes for utbot_executor-1.9.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f58bb138ceabe8c81aff8871dad00fe23dfc9477810a0c0113d6b73f61984d0 |
|
MD5 | 3f800e16c87b4187ad432a6b0b413004 |
|
BLAKE2b-256 | 56ba2e3339e7f0219365ca5f77d3d7d085da948eac7d7817596ad7ec81abdf79 |