From 3de7816fd25e6a5779793c4a6e796584945ac3b3 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sat, 19 Jan 2019 22:22:42 +0000 Subject: [PATCH] tests: Fix test broken by refactoring Signed-off-by: Niels Thykier --- tests/test_inst_tester.py | 64 +++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/tests/test_inst_tester.py b/tests/test_inst_tester.py index de229b3..f7c2015 100644 --- a/tests/test_inst_tester.py +++ b/tests/test_inst_tester.py @@ -4,7 +4,7 @@ import unittest from collections import OrderedDict from . import new_pkg_universe_builder -from britney2.installability.solver import compute_scc, InstallabilitySolver +from britney2.installability.solver import compute_scc, InstallabilitySolver, OrderNode class TestInstTester(unittest.TestCase): @@ -513,34 +513,40 @@ class TestInstTester(unittest.TestCase): graph = OrderedDict() - graph['A'] = { - 'before': ['C', 'B'], - 'after': ['A0'], - } - graph['B'] = { - 'before': ['F'], - 'after': ['A'], - } - graph['C'] = { - 'before': ['E', 'D'], - 'after': ['A'], - } - graph['D'] = { - 'before': [], - 'after': ['C'] - } - graph['E'] = { - 'before': ['B'], - 'after': ['C'] - } - graph['F'] = { - 'before': [], - 'after': ['B'] - } - graph['A0'] = { - 'before': ['A0'], - 'after': [] - } + def _order_node(**args): + node = OrderNode() + node.before = args['before'] + node.after = args['after'] + return node + + graph['A'] = _order_node( + before=['C', 'B'], + after=['A0'], + ) + graph['B'] = _order_node( + before=['F'], + after=['A'], + ) + graph['C'] = _order_node( + before=['E', 'D'], + after=['A'], + ) + graph['D'] = _order_node( + before=[], + after=['C'], + ) + graph['E'] = _order_node( + before=['B'], + after=['C'] + ) + graph['F'] = _order_node( + before=[], + after=['B'], + ) + graph['A0'] = _order_node( + before=['A0'], + after=[], + ) # We also assert that the order is correct to ensure that # nodes were visited in the order we expected (the bug is