diff --git a/tests/fixtures.py b/tests/fixtures.py index 17819eab2..e8bc15d05 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -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): diff --git a/tests/integration/characters/test_bob_handles_frags.py b/tests/integration/characters/test_bob_handles_frags.py index 189439503..c59f3430b 100644 --- a/tests/integration/characters/test_bob_handles_frags.py +++ b/tests/integration/characters/test_bob_handles_frags.py @@ -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() diff --git a/tests/integration/characters/test_bob_joins_policy_and_retrieves.py b/tests/integration/characters/test_bob_joins_policy_and_retrieves.py index cfa862b20..9bdd722ed 100644 --- a/tests/integration/characters/test_bob_joins_policy_and_retrieves.py +++ b/tests/integration/characters/test_bob_joins_policy_and_retrieves.py @@ -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