[Tests] Require exact match in assert_start_raises_init_eror (jnewbery) #12718

pull MarcoFalke wants to merge 3 commits into bitcoin:master from MarcoFalke:Mf1803-qaRegexInitError changing 7 files +66 −43
  1. MarcoFalke commented at 5:03 PM on March 18, 2018: member

    Extracted from #12379, because the changes are important on their own.

    This allows for exact testing, since the match can be specified with a strict regex. Internal details (such as exact formatting of the error message) can still be fuzzed away by regex wildcards.

  2. [Tests] Move assert_start_raises_init_error method to TestNode 0ec08a672d
  3. MarcoFalke added the label Tests on Mar 18, 2018
  4. [Tests] Require exact match in assert_start_raises_init_eror() 58122736b5
  5. MarcoFalke force-pushed on Mar 18, 2018
  6. MarcoFalke force-pushed on Mar 18, 2018
  7. laanwj commented at 8:31 AM on March 19, 2018: member

    I did a similar thing in #12302 initially and no one agreed :/

  8. MarcoFalke commented at 4:28 PM on March 19, 2018: member

    Hmm, I didn't notice the initial version of #12302, otherwise it would have been a Concept ACK from me

  9. laanwj commented at 4:58 PM on March 19, 2018: member

    Yeah doesn't matter, utACK

  10. MarcoFalke requested review from jnewbery on Mar 19, 2018
  11. jnewbery commented at 6:54 PM on March 19, 2018: member

    Tested ACK 58122736b53390a2013630e95ff760800af160e7

    Should be tested on other platforms in case stderr is different. See #12379 (comment) for example

    I did a similar thing in #12302 initially and no one agreed :/

    I think everyone agreed, but I argued that we should do the minimal fix required to get the v0.16 rc building and passing the tests.

  12. MarcoFalke commented at 6:56 PM on March 19, 2018: member

    @Sjors Do they still fail for you?

  13. jnewbery cross-referenced this on Mar 19, 2018 from issue [WIP] Better stderr testing in functional tests by jnewbery
  14. qa: Allow for partial_match when checking init error
    This allows the tests to pass on different platforms
    fae137454a
  15. in test/functional/test_framework/test_node.py:193 in fad4973241 outdated
     187 | @@ -188,8 +188,10 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, *ar
     188 |                  if expected_msg is not None:
     189 |                      log_stderr.seek(0)
     190 |                      stderr = log_stderr.read().decode('utf-8')
     191 | -                    if re.fullmatch(expected_msg + '\n', stderr) is None:
     192 | -                        raise AssertionError('Expected message "{}" does not match stderr:\n"{}"'.format(expected_msg, stderr))
     193 | +                    if partial_match and re.search(expected_msg, stderr) is None:
     194 | +                        raise AssertionError('Expected message "{}" does not parially match stderr:\n"{}"'.format(expected_msg, stderr))
     195 | +                    elif re.fullmatch(expected_msg + '\n', stderr) is None:
    


    jnewbery commented at 7:41 PM on March 19, 2018:

    This is wrong. Should be elif not partial_match and re.fullmatch(...)

    or nest the whole thing one level deeper:

    if partial match:
        if re.search(...) is None:
            #assert
    else:
        if re.fullmatch(...) is None:
            #assert
    
  16. MarcoFalke force-pushed on Mar 19, 2018
  17. MarcoFalke commented at 8:01 PM on March 19, 2018: member

    Added a commit to make the tests pass on windows

  18. jnewbery commented at 8:06 PM on March 19, 2018: member

    Tested ACK fae137454adc50a4e1d448ed7219a8f5344486c9. Works for me.

  19. Sjors commented at 3:00 PM on March 21, 2018: member

    @MarcoFalke on MacOS 10.13.3. wallet_encryption.py still fails with a timeout. wallet_multiwallet.py and wallet_multiwallet.py --usecli now pass.

    Running the full suite now; will update this comment if something new fails.

  20. laanwj commented at 9:30 AM on March 22, 2018: member

    Tested ACK fae1374

    @MarcoFalke on MacOS 10.13.3. wallet_encryption.py still fails with a timeout.

    Huh - we don't use any remotely complex regexes, so I wonder how this can cause timeout.

  21. laanwj merged this on Mar 22, 2018
  22. laanwj closed this on Mar 22, 2018

  23. laanwj referenced this in commit 185d48473e on Mar 22, 2018
  24. MarcoFalke deleted the branch on Mar 22, 2018
  25. ryanofsky cross-referenced this on Apr 6, 2018 from issue scripted-diff: Rename wallet database classes by ryanofsky
  26. jnewbery cross-referenced this on May 17, 2018 from issue [0.16] Further Backports by fanquake
  27. PastaPastaPasta referenced this in commit 62ece1f1ff on Sep 27, 2020
  28. PastaPastaPasta referenced this in commit 7a880f29df on Oct 22, 2020
  29. furszy cross-referenced this on Jul 24, 2021 from issue Solve filename and command line encoding issues on Windows by furszy
  30. random-zebra cross-referenced this on Jul 27, 2021 from issue [Tests] Require exact match in assert_raises_init_error by random-zebra
  31. random-zebra referenced this in commit 3f94147b3a on Aug 1, 2021
  32. random-zebra referenced this in commit 61a098a775 on Aug 5, 2021
  33. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC