Skip to content

Commit bd7ce05

Browse files
committed
test: fix TestShell initialization (late follow-up for #30463)
1 parent 6d54633 commit bd7ce05

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/functional/test_framework/test_shell.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
# Copyright (c) 2019-2022 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
import pathlib
56

67
from test_framework.test_framework import BitcoinTestFramework
78

9+
810
class TestShell:
911
"""Wrapper Class for BitcoinTestFramework.
1012
@@ -67,7 +69,13 @@ def __new__(cls):
6769
# This implementation enforces singleton pattern, and will return the
6870
# previously initialized instance if available
6971
if not TestShell.instance:
70-
TestShell.instance = TestShell.__TestShell()
72+
# BitcoinTestFramework instances are supposed to be constructed with the path
73+
# of the calling test in order to find shared data like configuration and the
74+
# cache. Since TestShell is meant for interactive use, there is no concrete
75+
# test; passing a dummy name is fine though, as only the containing directory
76+
# is relevant for successful initialization.
77+
tests_directory = pathlib.Path(__file__).resolve().parent.parent
78+
TestShell.instance = TestShell.__TestShell(tests_directory / "testshell_dummy.py")
7179
TestShell.instance.running = False
7280
return TestShell.instance
7381

0 commit comments

Comments
 (0)