From ba5f4c0332802ba904c73b8ba4ce9e6b40f7de31 Mon Sep 17 00:00:00 2001 From: fanquake Date: Sun, 18 Jun 2023 12:47:50 +0200 Subject: [PATCH] Merge bitcoin/bitcoin#27906: doc: test: update TestShell instructions 14405e8d4d259c18a21fc006d0a27550be3171f8 doc: test: update TestShell instructions (ismaelsadeeq) Pull request description: Fixes #27904 From #27904 and IRC. Update [Testshell instructions ](https://github.com/bitcoin/bitcoin/blob/master/test/functional/test-shell.md#2-importing-testshell-from-the-bitcoin-core-repository) E.g `TestShell.setup()` throws ``` AttributeError: type object 'TestShell' has no attribute 'setup' ``` Parentheses are missing, it should be `TestShell().setup()` ACKs for top commit: Sjors: utACK 14405e8d4d259c18a21fc006d0a27550be3171f8 brunoerg: crACK 14405e8d4d259c18a21fc006d0a27550be3171f8 hernanmarino: utACK 14405e8d4d259c18a21fc006d0a27550be3171f8 Tree-SHA512: ffe5fa1103a3b00ef0ee99879adae967b0da07cb8f8451c4c261b0a70b3b666af7aeaacd6f46f85a84ee5e9c7c7ed49700209b5b1f124d7a76efc420ad5c9cd9 --- test/functional/test-shell.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/functional/test-shell.md b/test/functional/test-shell.md index 78737509cb..e69d58d2ad 100644 --- a/test/functional/test-shell.md +++ b/test/functional/test-shell.md @@ -37,13 +37,13 @@ importing the `TestShell` class from the `test_shell` sub-package. The following `TestShell` methods manage the lifetime of the underlying bitcoind processes and logging utilities. -* `TestShell.setup()` -* `TestShell.shutdown()` +* `TestShell().setup()` +* `TestShell().shutdown()` The `TestShell` inherits all `BitcoinTestFramework` members and methods, such as: -* `TestShell.nodes[index].rpc_method()` -* `TestShell.log.info("Custom log message")` +* `TestShell().nodes[index].rpc_method()` +* `TestShell().log.info("Custom log message")` The following sections demonstrate how to initialize, run, and shut down a `TestShell` object. @@ -141,7 +141,7 @@ instances and remove all temporary data and logging directories. 20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Tests successful ``` To prevent the logs from being removed after a shutdown, simply set the -`TestShell.options.nocleanup` member to `True`. +`TestShell().options.nocleanup` member to `True`. ``` >>> test.options.nocleanup = True >>> test.shutdown() @@ -160,9 +160,9 @@ underlying `BitcoinTestFramework`: The `TestShell` object initializes with the default settings inherited from the `BitcoinTestFramework` class. The user can override these in -`TestShell.setup(key=value)`. +`TestShell().setup(key=value)`. -**Note:** `TestShell.reset()` will reset test parameters to default values and +**Note:** `TestShell().reset()` will reset test parameters to default values and can be called after the TestShell is shut down. | Test parameter key | Default Value | Description | @@ -179,7 +179,7 @@ can be called after the TestShell is shut down. | `perf` | False | Profiles running nodes with `perf` for the duration of the test if set to `True`. | | `rpc_timeout` | `60` | Sets the RPC server timeout for the underlying bitcoind processes. | | `setup_clean_chain` | `False` | A 200-block-long chain is initialized from cache by default. Instead, `setup_clean_chain` initializes an empty blockchain if set to `True`. | -| `randomseed` | Random Integer | `TestShell.options.randomseed` is a member of `TestShell` which can be accessed during a test to seed a random generator. User can override default with a constant value for reproducible test runs. | +| `randomseed` | Random Integer | `TestShell().options.randomseed` is a member of `TestShell` which can be accessed during a test to seed a random generator. User can override default with a constant value for reproducible test runs. | | `supports_cli` | `False` | Whether the bitcoin-cli utility is compiled and available for the test. | | `tmpdir` | `"/var/folders/.../"` | Sets directory for test logs. Will be deleted upon a successful test run unless `nocleanup` is set to `True` | | `trace_rpc` | `False` | Logs all RPC calls if set to `True`. |