Creating a TestShell
instance as stated in the docs currently fails on master:
0$ python3
1Python 3.10.13 (main, Mar 15 2024, 07:36:23) [Clang 16.0.6 ] on openbsd7
2Type "help", "copyright", "credits" or "license" for more information.
3>>> import sys
4>>> sys.path.insert(0, "/home/thestack/bitcoin/test/functional")
5>>> from test_framework.test_shell import TestShell
6>>> test = TestShell().setup(num_nodes=2, setup_clean_chain=True)
7Traceback (most recent call last):
8 File "<stdin>", line 1, in <module>
9 File "/home/thestack/bitcoin/test/functional/test_framework/test_shell.py", line 70, in __new__
10 TestShell.instance = TestShell.__TestShell()
11TypeError: BitcoinTestFramework.__init__() missing 1 required positional argument: 'test_file'
Since #30463, BitcoinTestFramework instances expect the path of the calling test at construction, in order to find shared data like the configuration (config.ini) and the cache. Note that in contrast to actual functional tests, we can’t simply pass __file__
here, as the test shell module sits within the test_framework
subfolder, so we have to navigate up to the parent directory and append some dummy test file name.
On the long-term we should probably add some TestShell instantation smoke-test to detect issues like this early. As I’m not too familiar with the CI I’m not sure what is a good way to achieve this (a functional test obviously can’t be used, as that’s already a BitcoinTestFramework test in itself), but happy to take suggestions.