mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 10:42:23 +02:00
Merge bitcoin/bitcoin#31415: test: fix TestShell initialization and reset()
303f8cca05
test: fix TestShell initialization and reset() (Brandon Odiwuor) Pull request description: Fixes TestShell initialization issues caused by resolving symlinks and looking for config.ini in the source path instead of the build path after migration to CMake (see https://github.com/bitcoin/bitcoin/issues/31131#issuecomment-2433056070)ebe4cac38b/test/functional/test_framework/test_shell.py (L77)
also fixes https://github.com/bitcoin/bitcoin/issues/31131 **How to test:** ``` $ python3 >>> import sys >>> sys.path.insert(0, "./path/to/bitcoin/build/test/functional") >>> from test_framework.test_shell import TestShell >>> TestShell().setup(num_nodes=2, setup_clean_chain=True) >>> TestShell().shutdown() >>> TestShell.reset() ``` ACKs for top commit: pinheadmz: ACK303f8cca05
theStack: Tested ACK303f8cca05
pablomartin4btc: re-ACK303f8cca05
Tree-SHA512: 25396eb2f7e4bf14426399b1eb3d2c988903ab1f3d38a58f1044b67dd7200c11c01686578fb49b0f2943864166c5c9ccbf122b45202a1e723bf3dbf0c90020fa
This commit is contained in:
@ -61,7 +61,8 @@ class TestShell:
|
||||
print("Shutdown TestShell before resetting!")
|
||||
else:
|
||||
self.num_nodes = None
|
||||
super().__init__()
|
||||
dummy_testshell_file = pathlib.Path(__file__).absolute().parent.parent / "testshell_dummy.py"
|
||||
super().__init__(dummy_testshell_file)
|
||||
|
||||
instance = None
|
||||
|
||||
@ -74,8 +75,8 @@ class TestShell:
|
||||
# cache. Since TestShell is meant for interactive use, there is no concrete
|
||||
# test; passing a dummy name is fine though, as only the containing directory
|
||||
# is relevant for successful initialization.
|
||||
tests_directory = pathlib.Path(__file__).resolve().parent.parent
|
||||
TestShell.instance = TestShell.__TestShell(tests_directory / "testshell_dummy.py")
|
||||
dummy_testshell_file = pathlib.Path(__file__).absolute().parent.parent / "testshell_dummy.py"
|
||||
TestShell.instance = TestShell.__TestShell(dummy_testshell_file)
|
||||
TestShell.instance.running = False
|
||||
return TestShell.instance
|
||||
|
||||
|
Reference in New Issue
Block a user