tests: try to eliminate random failures from mpp_split tests
closes: #7062
This commit is contained in:
@@ -24,7 +24,7 @@ def unique_hierarchy(hierarchy: Dict[int, List[Dict[bytes, int]]]) -> Dict[int,
|
|||||||
for config in configs:
|
for config in configs:
|
||||||
# config dict can be out of order, so sort, otherwise not unique
|
# config dict can be out of order, so sort, otherwise not unique
|
||||||
unique_configs.add(tuple((c, config[c]) for c in sorted(config.keys())))
|
unique_configs.add(tuple((c, config[c]) for c in sorted(config.keys())))
|
||||||
for unique_config in unique_configs:
|
for unique_config in sorted(unique_configs):
|
||||||
new_hierarchy[number_parts].append(
|
new_hierarchy[number_parts].append(
|
||||||
{t[0]: t[1] for t in unique_config})
|
{t[0]: t[1] for t in unique_config})
|
||||||
return new_hierarchy
|
return new_hierarchy
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import random
|
||||||
|
|
||||||
import electrum.mpp_split as mpp_split # side effect for PART_PENALTY
|
import electrum.mpp_split as mpp_split # side effect for PART_PENALTY
|
||||||
from electrum.lnutil import NoPathFound
|
from electrum.lnutil import NoPathFound
|
||||||
|
|
||||||
@@ -9,6 +11,8 @@ PART_PENALTY = mpp_split.PART_PENALTY
|
|||||||
class TestMppSplit(ElectrumTestCase):
|
class TestMppSplit(ElectrumTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
# to make tests reproducible:
|
||||||
|
random.seed(0)
|
||||||
# undo side effect
|
# undo side effect
|
||||||
mpp_split.PART_PENALTY = PART_PENALTY
|
mpp_split.PART_PENALTY = PART_PENALTY
|
||||||
self.channels_with_funds = {
|
self.channels_with_funds = {
|
||||||
|
|||||||
Reference in New Issue
Block a user