From c1a111b68cd0bbb9f44476cb107bc18ecfb34378 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 26 Jun 2022 14:06:01 +0930 Subject: [PATCH] pytest: wait for stderr, rather than asserting. Two almost identical assertion fails under CI. Try waiting. Signed-off-by: Rusty Russell --- tests/test_gossip.py | 2 +- tests/test_plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 5afe5f1c9..acbeeba94 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -244,7 +244,7 @@ def test_only_announce_one_dns(node_factory, bitcoind): # and test that we can't announce more than one DNS address l1 = node_factory.get_node(may_fail=True, expect_fail=True, options={'announce-addr': ['localhost.localdomain:12345', 'example.com:12345']}) - assert l1.daemon.is_in_stderr("Only one DNS can be announced") + wait_for(lambda: l1.daemon.is_in_stderr("Only one DNS can be announced")) @pytest.mark.developer("needs DEVELOPER=1") diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 8a9f395ac..c18be94a5 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -95,7 +95,7 @@ def test_option_types(node_factory): # the node should fail to start, and we get a stderr msg assert not n.daemon.running - assert n.daemon.is_in_stderr('bool_opt: ! does not parse as type bool') + wait_for(lambda: n.daemon.is_in_stderr('bool_opt: ! does not parse as type bool')) # What happens if we give it a bad int-option? n = node_factory.get_node(options={