Repository: bitcoin/bitcoin
File: test/functional/test_framework/test_framework.py (Python)

Code before:
                # It still needs to exist and be None in order for tests to work however.
                # So set it to None, which will also set -disablewallet.
                self.options.descriptors = None

        PortSeed.n = self.options.port_seed

    def get_binary_paths(self):
        """Get paths of all binaries from environment variables or their default values"""

        paths = types.SimpleNamespace()
        binaries = {
            "bitcoind": ("bitcoind", "BITCOIND"),
            "bitcoin-cli": ("bitcoincli", "BITCOINCLI"),
            "bitcoin-util": ("bitcoinutil", "BITCOINUTIL"),
            "bitcoin-wallet": ("bitcoinwallet", "BITCOINWALLET"),
        }
        for binary, [attribute_name, env_variable_name] in binaries.items():
            default_filename = os.path.join(
                self.config["environment"]["BUILDDIR"],
                "src",
                binary + self.config["environment"]["EXEEXT"],
            )
            setattr(paths, attribute_name, os.getenv(env_variable_name, default=default_filename))

        # BITCOIN_CMD environment variable can be specified to invoke bitcoin
        # binary wrapper binary instead of other executables.
        paths.bitcoin_cmd = shlex.split(os.getenv("BITCOIN_CMD", "")) or None
        return paths

    def setup(self):
        """Call this method to start up the test framework object with options set."""

        check_json_precision()

        self.options.cachedir = os.path.abspath(self.options.cachedir)

        config = self.config

        os.environ['PATH'] = os.pathsep.join([
            os.path.join(config['environment']['BUILDDIR'], 'src'),
            os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH']
        ])

        # Set up temp directory and start logging
        if self.options.tmpdir:
            self.options.tmpdir = os.path.abspath(self.options.tmpdir)
            os.makedirs(self.options.tmpdir, exist_ok=False)
        else:
            self.options.tmpdir = tempfile.mkdtemp(prefix=TMPDIR_PREFIX)
        self._start_logging()


Review comment (suggestion):
```suggestion
        # BITCOIN_CMD environment variable can be specified to invoke bitcoin
        # wrapper binary instead of other executables.
```

Code after:

        config = configparser.ConfigParser()
        config.read_file(open(self.options.configfile))
        self.config = config
        self.binary_paths = self.get_binary_paths()
        if self.options.v1transport:
            self.options.v2transport=False

        PortSeed.n = self.options.port_seed

    def get_binary_paths(self):
        """Get paths of all binaries from environment variables or their default values"""

        paths = types.SimpleNamespace()
        binaries = {
            "bitcoind": ("bitcoind", "BITCOIND"),
            "bitcoin-cli": ("bitcoincli", "BITCOINCLI"),
            "bitcoin-util": ("bitcoinutil", "BITCOINUTIL"),
            "bitcoin-chainstate": ("bitcoinchainstate", "BITCOINCHAINSTATE"),
            "bitcoin-wallet": ("bitcoinwallet", "BITCOINWALLET"),
        }
        for binary, [attribute_name, env_variable_name] in binaries.items():
            default_filename = os.path.join(
                self.config["environment"]["BUILDDIR"],
                "bin",
                binary + self.config["environment"]["EXEEXT"],
            )
            setattr(paths, attribute_name, os.getenv(env_variable_name, default=default_filename))
        # BITCOIN_CMD environment variable can be specified to invoke bitcoin
        # wrapper binary instead of other executables.
        paths.bitcoin_cmd = shlex.split(os.getenv("BITCOIN_CMD", "")) or None
        return paths

    def get_binaries(self, bin_dir=None):
        return Binaries(self.binary_paths, bin_dir)

    def setup(self):
        """Call this method to start up the test framework object with options set."""

        check_json_precision()

        self.options.cachedir = os.path.abspath(self.options.cachedir)

        config = self.config

        os.environ['PATH'] = os.pathsep.join([
            os.path.join(config['environment']['BUILDDIR'], 'bin'),
            os.environ['PATH']
        ])

        # Set up temp directory and start logging