Skip to content

Do not force CLI ArgumentParser in non-pytest .py scripts that use test-tools

Requires:

Related MR:

This MR removes forcing the CLI argument parser for a non-pytest .py scripts.

Rationale:

  • we already have a way of setting executable paths and we do it by specyfying the environment variables.

  • in .py scripts using test-tools it causes problems when this script defines it's own ArgumentParser. In such a situation test-tools parser takes precedence and overrides the one which user defined in its .py script.

    Example:

    usage: testnet_node.py [-h] [--build-root-path BUILD_ROOT] [--hived-path HIVED] [--cli-wallet-path CLI_WALLET] [--get-dev-key-path GET_DEV_KEY] [--compress-block-log-path COMPRESS_BLOCK_LOG]
    
    options:
      -h, --help            show this help message and exit
      --build-root-path BUILD_ROOT
      --hived-path HIVED
      --cli-wallet-path CLI_WALLET
      --get-dev-key-path GET_DEV_KEY
      --compress-block-log-path COMPRESS_BLOCK_LOG

    Before the test-tools integration with helpy it was possible to workaround this situation (in a ugly way although) by calling .py script .parse_args() before importing test-tools.

    I believe that this functionality is unnecessary from the above point and only generates problems. The use of test-tools should not overwrite the cli parser argument in the .py script which uses them.

Edited by Mateusz Żebrak

Merge request reports