Flagging test bob's origins for inspection on other threads.

pull/2155/head
jMyles 2020-07-20 13:32:23 -07:00
parent 4261743594
commit 4a616d143d
3 changed files with 16 additions and 4 deletions

View File

@ -360,15 +360,19 @@ def blockchain_alice(alice_blockchain_test_config, testerchain):
@pytest.fixture(scope="module")
def federated_bob(bob_federated_test_config):
frames = inspect.stack(3)
bob = bob_federated_test_config.produce()
return bob
# Since Bob is sometimes "left hanging" at the end of tests, this is an invaluable piece of information for debugging problems like #2150.
bob._FOR_TEST = frames[1].frame.f_locals['request'].module
yield bob
bob.disenchant()
@pytest.fixture(scope="module")
def blockchain_bob(bob_blockchain_test_config, testerchain):
_bob = bob_blockchain_test_config.produce()
return _bob
bob = bob_blockchain_test_config.produce()
yield bob
bob.disenchant()
@pytest.fixture(scope="module")
def federated_ursulas(ursula_federated_test_config):

View File

@ -85,6 +85,10 @@ def test_bob_can_follow_treasure_map_even_if_he_only_knows_of_one_node(enacted_f
abort_on_learning_error=True,
federated_only=True)
import inspect
frame = inspect.currentframe()
bob._FOR_TEST = frame.f_code.co_name
# Again, let's assume that he received the TreasureMap via a side channel.
hrac, treasure_map = enacted_federated_policy.hrac(), enacted_federated_policy.treasure_map
map_id = treasure_map.public_id()

View File

@ -74,6 +74,10 @@ def test_bob_joins_policy_and_retrieves(federated_alice,
known_nodes=a_couple_of_ursulas,
)
import inspect
frame = inspect.currentframe()
bob._FOR_TEST = frame.f_code.co_name
# Bob has only connected to 2 nodes.
assert sum(node.verified_node for node in bob.known_nodes) == 2