test: replace 'regtest' leftovers by self.chain #18069

pull theStack wants to merge 1 commits into bitcoin:master from theStack:20200205-test-replace-regtest-by-self_chain changing 2 files +3 −3
  1. theStack commented at 3:36 AM on February 5, 2020: member

    This is a follow-up PR to #16681 (fixes #18068), replacing all remaining hardcoded "regtest" strings in functional tests by self.chain.

  2. test: replace 'regtest' leftovers by self.chain
    Commit 1abcecc40c518a98b7d17880657ec0247abdf125 replaced 'regtest' by self.chain
    'regtest' "in almost all current tests", this commit takes care of the remaining
    ones.
    eca56f8929
  3. fanquake added the label Tests on Feb 5, 2020
  4. fanquake requested review from MarcoFalke on Feb 5, 2020
  5. in test/functional/feature_config_args.py:97 in eca56f8929
      92 | @@ -93,8 +93,8 @@ def test_args_log(self):
      93 |                      'Command-line arg: rpcpassword=****',
      94 |                      'Command-line arg: rpcuser=****',
      95 |                      'Command-line arg: torpassword=****',
      96 | -                    'Config file arg: regtest="1"',
      97 | -                    'Config file arg: [regtest] server="1"',
      98 | +                    'Config file arg: %s="1"' % self.chain,
      99 | +                    'Config file arg: [%s] server="1"' % self.chain,
    


    MarcoFalke commented at 10:42 AM on February 5, 2020:

    I'd prefer '{}'.format

  6. MarcoFalke approved
  7. MarcoFalke referenced this in commit bd5c4c6971 on Feb 5, 2020
  8. MarcoFalke merged this on Feb 5, 2020
  9. MarcoFalke closed this on Feb 5, 2020

  10. in test/functional/rpc_dumptxoutset.py:28 in eca56f8929
      24 | @@ -25,7 +25,7 @@ def run_test(self):
      25 |  
      26 |          FILENAME = 'txoutset.dat'
      27 |          out = node.dumptxoutset(FILENAME)
      28 | -        expected_path = Path(node.datadir) / 'regtest' / FILENAME
      29 | +        expected_path = Path(node.datadir) / self.chain / FILENAME
    


    laanwj commented at 10:45 AM on February 5, 2020:

    This rules out running on mainnet, which doesn't add a chain-named subdir (but I guess that's okay as this test would never be suitable for that)


    MarcoFalke commented at 11:17 AM on February 5, 2020:

    It should work fine for the main chain. Note that self.chain refers to the datadir name, see also #17556 (review)

    >>> pathlib.Path('/tmp/a') / '' / 'c'
    PosixPath('/tmp/a/c')
    
  11. in test/functional/feature_config_args.py:96 in eca56f8929
      92 | @@ -93,8 +93,8 @@ def test_args_log(self):
      93 |                      'Command-line arg: rpcpassword=****',
      94 |                      'Command-line arg: rpcuser=****',
      95 |                      'Command-line arg: torpassword=****',
      96 | -                    'Config file arg: regtest="1"',
      97 | -                    'Config file arg: [regtest] server="1"',
      98 | +                    'Config file arg: %s="1"' % self.chain,
    


    jtimon commented at 12:30 PM on February 7, 2020:

    this could have also been 'Config file arg: chain=%s=' % self.chain, but this works too.


    theStack commented at 1:08 PM on February 7, 2020:

    This wouldn't work, as the fundamental content of the config file is not written by this test itself right now at this stage, but by the function util.initialize_datadir() in the course of setting up the BitcoinTestFramework, which uses the chainname=1 format: https://github.com/bitcoin/bitcoin/blob/23fab1a3dfe6f308880197dbe2bd7ce70866f13c/test/functional/test_framework/util.py#L311-L313

  12. jtimon commented at 12:30 PM on February 7, 2020: contributor

    ACK eca56f89293b74f11ca631ff2a0793e970e65841

  13. jtimon commented at 3:55 AM on February 8, 2020: contributor

    I think that would work even without chaning that line, but that line can be changed too. I actually need yo vhange it in one of my currently open prs. But, anyway, it is better than it was, still ack.

    On Fri, Feb 7, 2020, 13:09 Sebastian Falbesoner notifications@github.com wrote:

    @theStack commented on this pull request.

    In test/functional/feature_config_args.py https://github.com/bitcoin/bitcoin/pull/18069#discussion_r376380643:

    @@ -93,8 +93,8 @@ def test_args_log(self): 'Command-line arg: rpcpassword=****', 'Command-line arg: rpcuser=****', 'Command-line arg: torpassword=****',

    •                'Config file arg: regtest="1"',
    •                'Config file arg: [regtest] server="1"',
    •                'Config file arg: %s="1"' % self.chain,

    This wouldn't work, as the fundamental content of the config file is not written by this test itself right now at this stage, but by the function util.initialize_datadir() in the course of setting up the BitcoinTestFramework, which uses the chainname=1 format:

    https://github.com/bitcoin/bitcoin/blob/23fab1a3dfe6f308880197dbe2bd7ce70866f13c/test/functional/test_framework/util.py#L311-L313

    — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/18069?email_source=notifications&email_token=AAHWGSRWBP2STW4II7VNKDDRBVMOZA5CNFSM4KQEHNJKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCUVQ26Y#discussion_r376380643, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHWGSSEYA3AWPLADAPLTGDRBVMOZANCNFSM4KQEHNJA .

  14. theStack deleted the branch on Dec 1, 2020
  15. Fabcien referenced this in commit 736e9068fc on Dec 22, 2020
  16. DrahtBot locked this on Feb 15, 2022

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-04-14 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me