Skip to content

Commit

Permalink
test: caplog test compatible with python < 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamantios committed Jun 23, 2023
1 parent bd9551b commit 3182f39
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/package_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
| skill/valory/register_reset_recovery_abci/0.1.0 | `bafybeidhpve4golhs7ausnbwuektxocbdymgccszhwazgjkpsl26l44qaq` | ABCI application for dummy skill that registers and resets |
| agent/valory/register_reset_recovery/0.1.0 | `bafybeiaaerbgxf7deoemjttmxqtahqyp5v7knsyil5fv5oid743p3hstvm` | Agent to showcase hard reset as a recovery mechanism. |
| contract/valory/multicall2/0.1.0 | `bafybeigywp4gpl6lel2bemehbvevpfflnwnpjaq3wnb7o7rjnwzqrlnijq` | The MakerDAO multicall2 contract. |
| skill/valory/slashing_abci/0.1.0 | `bafybeidz3zvaukitwr2z3mavykpiq4pi7qgpnamskxagynmved3sgpjgqq` | Slashing skill. |
| skill/valory/slashing_abci/0.1.0 | `bafybeih2xzc2yf52rjajur2yllaz3e2xryhfuiopwjqlvyoxbmzpgoxwga` | Slashing skill. |
| protocol/open_aea/signing/1.0.0 | `bafybeibqlfmikg5hk4phzak6gqzhpkt6akckx7xppbp53mvwt6r73h7tk4` | A protocol for communication between skills and decision maker. |
| protocol/valory/acn/1.1.0 | `bafybeignmc5uh3vgpuckljcj2tgg7hdqyytkm6m5b6v6mxtazdcvubibva` | The protocol used for envelope delivery on the ACN. |
| protocol/valory/http/1.0.0 | `bafybeifyoio7nlh5zzyn5yz7krkou56l22to3cwg7gw5v5o3vxwklibhty` | A protocol for HTTP requests and responses. |
Expand Down
2 changes: 1 addition & 1 deletion packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"skill/valory/register_reset_recovery_abci/0.1.0": "bafybeidhpve4golhs7ausnbwuektxocbdymgccszhwazgjkpsl26l44qaq",
"agent/valory/register_reset_recovery/0.1.0": "bafybeiaaerbgxf7deoemjttmxqtahqyp5v7knsyil5fv5oid743p3hstvm",
"contract/valory/multicall2/0.1.0": "bafybeigywp4gpl6lel2bemehbvevpfflnwnpjaq3wnb7o7rjnwzqrlnijq",
"skill/valory/slashing_abci/0.1.0": "bafybeidz3zvaukitwr2z3mavykpiq4pi7qgpnamskxagynmved3sgpjgqq"
"skill/valory/slashing_abci/0.1.0": "bafybeih2xzc2yf52rjajur2yllaz3e2xryhfuiopwjqlvyoxbmzpgoxwga"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeibqlfmikg5hk4phzak6gqzhpkt6akckx7xppbp53mvwt6r73h7tk4",
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/slashing_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fingerprint:
payloads.py: bafybeigl4mecg2e3gxhqifv33kucusug6t6lcfthbtvffpmohgt552j7vu
rounds.py: bafybeievt3nfx3dqr6m2ni22yiiwnrouy6tdtzb5eggqa5ltyj6ejacorm
tests/__init__.py: bafybeiesff34nldcxucqzb7fz5bg6awtqxgcafvasecdsh5eutmtahwaeu
tests/test_behaviours.py: bafybeidt3ige5goq3awukxn36vfzba3c62hl7ln2sn757uofxobu5ibdli
tests/test_behaviours.py: bafybeicama4xsdthtbibej57kvqvnslo5jstyzuynmwl3y2gkuw5itwpwm
tests/test_dialogues.py: bafybeiaipkfzciwtc6emjsi2vatof3tjptxww5cwqymefs57co7f2hb6pe
tests/test_handlers.py: bafybeicbxl2n4ch6p347ksb6dgm2orebrbj26oplfhvkk25l5crspzbvs4
tests/test_models.py: bafybeifnjo33d2q2hsqcf4bwdk7wcp45amt7idogup24botupdo7u4cuju
Expand Down
7 changes: 5 additions & 2 deletions packages/valory/skills/slashing_abci/tests/test_behaviours.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# pylint: disable=protected-access

import json
import logging
from copy import deepcopy
from dataclasses import dataclass
from datetime import datetime
Expand Down Expand Up @@ -197,15 +198,17 @@ def test_get_callback_request(

callback = self.current_behaviour.get_callback_request()
message_mock = MagicMock()
callback(message_mock, MagicMock())
with caplog.at_level(logging.INFO):
callback(message_mock, MagicMock())
try_send_mock.assert_not_called()
assert (
f"dropping message as behaviour has stopped: {message_mock}" in caplog.text
)

# call act wrapper so that `__call_act_first_time()` is triggered, which sets `self.__stopped = False`
self.behaviour.act_wrapper()
callback(message_mock, MagicMock())
with caplog.at_level(logging.INFO):
callback(message_mock, MagicMock())
try_send_mock.assert_not_called()
assert (
f"could not send message {message_mock} to {self.current_behaviour.behaviour_id}"
Expand Down

0 comments on commit 3182f39

Please sign in to comment.