piston-lib
piston-lib copied to clipboard
Unit-tests are failing in develop and master branches.
When trying to run tests in the develop
and master
branches of the projects they fail while testing get_categories
method.
Here is a traceback:
self = <pistonapi.steemnoderpc.SteemNodeRPC object at 0x7f5e72548a58>, payload = {'id': 27, 'jsonrpc': '2.0', 'method': 'call', 'params': [0, 'get_trending_categories', [None, 10]]}
def rpcexec(self, payload):
""" Execute a call by sending the payload
:param json payload: Payload data
:raises ValueError: if the server does not respond in proper JSON format
:raises RPCError: if the server returns an error
"""
log.debug(json.dumps(payload))
cnt = 0
while True:
cnt += 1
try:
self.ws.send(json.dumps(payload, ensure_ascii=False).encode('utf8'))
reply = self.ws.recv()
break
except KeyboardInterrupt:
raise
except:
if (self.num_retries > -1 and
cnt > self.num_retries):
raise NumRetriesReached()
sleeptime = (cnt - 1) * 2 if cnt < 10 else 10
if sleeptime:
log.warning(
"Lost connection to node during rpcexec(): %s (%d/%d) "
% (self.url, cnt, self.num_retries) +
"Retrying in %d seconds" % sleeptime
)
time.sleep(sleeptime)
# retry
try:
self.ws.close()
time.sleep(sleeptime)
self.wsconnect()
self.register_apis()
except:
pass
ret = {}
try:
ret = json.loads(reply, strict=False)
except ValueError:
raise ValueError("Client returned invalid format. Expected JSON!")
log.debug(json.dumps(reply))
if 'error' in ret:
if 'detail' in ret['error']:
raise RPCError(ret['error']['detail'])
else:
> raise RPCError(ret['error']['message'])
E grapheneapi.graphenewsrpc.RPCError: 10 assert_exception: Assert Exception
E itr != _by_name.end(): no method with name 'get_trending_categories'
E {"name":"get_trending_categories","api":{"cancel_all_subscriptions":3,"get_account_bandwidth":45,"get_account_count":38,"get_account_history":40,"get_account_references":35,"get_account_votes":60,"get_accounts":34,"get_active_votes":59,"get_active_witnesses":70,"get_block":21,"get_block_header":20,"get_chain_properties":26,"get_comment_discussions_by_payout":8,"get_config":24,"get_content":61,"get_content_replies":62,"get_conversion_requests":39,"get_current_median_history_price":28,"get_discussions_by_active":11,"get_discussions_by_author_before_date":63,"get_discussions_by_blog":17,"get_discussions_by_cashout":12,"get_discussions_by_children":14,"get_discussions_by_comments":18,"get_discussions_by_created":10,"get_discussions_by_feed":16,"get_discussions_by_hot":15,"get_discussions_by_payout":6,"get_discussions_by_promoted":19,"get_discussions_by_trending":9,"get_discussions_by_votes":13,"get_dynamic_global_properties":25,"get_escrow":43,"get_expiring_vesting_delegations":49,"get_feed_history":27,"get_hardfork_version":30,"get_key_references":33,"get_liquidity_queue":52,"get_miner_queue":71,"get_next_scheduled_hardfork":31,"get_open_orders":51,"get_ops_in_block":22,"get_order_book":50,"get_owner_history":41,"get_post_discussions_by_payout":7,"get_potential_signatures":56,"get_recovery_request":42,"get_replies_by_last_update":64,"get_required_signatures":55,"get_reward_fund":32,"get_savings_withdraw_from":46,"get_savings_withdraw_to":47,"get_state":23,"get_tags_used_by_author":5,"get_transaction":54,"get_transaction_hex":53,"get_trending_tags":4,"get_vesting_delegations":48,"get_withdraw_routes":44,"get_witness_by_account":66,"get_witness_count":69,"get_witness_schedule":29,"get_witnesses":65,"get_witnesses_by_vote":67,"lookup_account_names":36,"lookup_accounts":37,"lookup_witness_accounts":68,"set_block_applied_callback":2,"set_pending_transaction_callback":1,"set_subscribe_callback":0,"verify_account_authority":58,"verify_authority":57}}
E th_a api_connection.hpp:109 call
E
E {"call.method":"call","call.params":[0,"get_trending_categories",[null,10]]}
E th_a websocket_api.cpp:124 on_message
.tox/py36/lib/python3.6/site-packages/grapheneapi/graphenewsrpc.py:160: RPCError
During handling of the above exception, another exception occurred:
self = <test_steem.Testcases testMethod=test_get_categories>
def test_get_categories(self):
> steem.get_categories(sort="trending")
tests/test_steem.py:117:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
piston/steem.py:1048: in get_categories
return func(begin, limit)
.tox/py36/lib/python3.6/site-packages/grapheneapi/graphenewsrpc.py:195: in method
r = self.rpcexec(query)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pistonapi.steemnoderpc.SteemNodeRPC object at 0x7f5e72548a58>, payload = {'id': 27, 'jsonrpc': '2.0', 'method': 'call', 'params': [0, 'get_trending_categories', [None, 10]]}
def rpcexec(self, payload):
""" Execute a call by sending the payload.
It makes use of the GrapheneRPC library.
In here, we mostly deal with Steem specific error handling
:param json payload: Payload data
:raises ValueError: if the server does not respond in proper JSON format
:raises RPCError: if the server returns an error
"""
try:
# Forward call to GrapheneWebsocketRPC and catch+evaluate errors
return super(SteemNodeRPC, self).rpcexec(payload)
except RPCError as e:
msg = exceptions.decodeRPCErrorMsg(e).strip()
if msg == "Account already transacted this block.":
raise exceptions.AlreadyTransactedThisBlock(msg)
elif msg == "missing required posting authority":
raise exceptions.MissingRequiredPostingAuthority
elif msg == "Voting weight is too small, please accumulate more voting power or steem power.":
raise exceptions.VoteWeightTooSmall(msg)
elif msg == "Can only vote once every 3 seconds.":
raise exceptions.OnlyVoteOnceEvery3Seconds(msg)
elif msg == "You have already voted in a similar way.":
raise exceptions.AlreadyVotedSimilarily(msg)
elif msg == "You may only post once every 5 minutes.":
raise exceptions.PostOnlyEvery5Min(msg)
elif msg == "Duplicate transaction check failed":
raise exceptions.DuplicateTransaction(msg)
elif msg == "Account exceeded maximum allowed bandwidth per vesting share.":
raise exceptions.ExceededAllowedBandwidth(msg)
elif re.match("^no method with name.*", msg):
> raise exceptions.NoMethodWithName(msg)
E pistonapi.exceptions.NoMethodWithName: no method with name 'get_trending_categories'
This is due to the removal of the Category functionality out of the steem:
https://github.com/steemit/steem/issues/1032
As far as I can see get_trending_categories
is now solely replaced by get_trending_tags
method and rest of get_*_categories
methods are now removed.