Skip to content

Commit

Permalink
test: fix TestShell initialization (late follow-up for bitcoin#30463)
Browse files Browse the repository at this point in the history
  • Loading branch information
theStack committed Aug 25, 2024
1 parent 6d54633 commit bd7ce05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/functional/test_framework/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
# Copyright (c) 2019-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import pathlib

from test_framework.test_framework import BitcoinTestFramework


class TestShell:
"""Wrapper Class for BitcoinTestFramework.
Expand Down Expand Up @@ -67,7 +69,13 @@ def __new__(cls):
# This implementation enforces singleton pattern, and will return the
# previously initialized instance if available
if not TestShell.instance:
TestShell.instance = TestShell.__TestShell()
# BitcoinTestFramework instances are supposed to be constructed with the path
# of the calling test in order to find shared data like configuration and the
# 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")
TestShell.instance.running = False
return TestShell.instance

Expand Down

0 comments on commit bd7ce05

Please sign in to comment.