| 78 | |
| 79 | @pytest.fixture() |
| 80 | def cli_args( |
| 81 | logs_storage: str, |
| 82 | raiden_testchain: Dict[str, Any], |
| 83 | local_matrix_servers: List[ParsedURL], |
| 84 | removed_args: Optional[Dict[str, Any]], |
| 85 | changed_args: Optional[Dict[str, Any]], |
| 86 | environment_type: Environment, |
| 87 | ) -> List[str]: |
| 88 | initial_args = raiden_testchain.copy() |
| 89 | |
| 90 | if removed_args is not None: |
| 91 | for arg in removed_args: |
| 92 | if arg in initial_args: |
| 93 | del initial_args[arg] |
| 94 | |
| 95 | if changed_args is not None: |
| 96 | for k, v in changed_args.items(): |
| 97 | initial_args[k] = v |
| 98 | |
| 99 | # The CLI param is `--network-id` for legacy reasons. We use `chain_id` as variable name. |
| 100 | initial_args["network_id"] = initial_args.pop("chain_id") |
| 101 | |
| 102 | # This assumes that there is only one Raiden instance per CLI test |
| 103 | base_logfile = os.path.join(logs_storage, "raiden_nodes", "cli_test.log") |
| 104 | |
| 105 | os.makedirs(os.path.dirname(base_logfile), exist_ok=True) |
| 106 | |
| 107 | args = [ |
| 108 | "--gas-price", |
| 109 | "1000000000", |
| 110 | "--no-sync-check", |
| 111 | f"--debug-logfile-path={base_logfile}", |
| 112 | "--matrix-server", |
| 113 | local_matrix_servers[0], |
| 114 | ] |
| 115 | |
| 116 | args += ["--environment-type", environment_type.value] |
| 117 | |
| 118 | for arg_name, arg_value in initial_args.items(): |
| 119 | if arg_name == "sync_check": |
| 120 | # Special case |
| 121 | continue |
| 122 | arg_name_cli = "--" + arg_name.replace("_", "-") |
| 123 | if arg_name_cli not in args: |
| 124 | args.append(arg_name_cli) |
| 125 | if arg_value is not None: |
| 126 | args.append(arg_value) |
| 127 | |
| 128 | return args |
| 129 | |
| 130 | |
| 131 | @pytest.fixture |