aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/functional/rpc_dumptxoutset.py2
-rw-r--r--test/functional/test_framework/authproxy.py3
-rwxr-xr-xtest/functional/test_framework/test_node.py12
-rw-r--r--test/functional/test_framework/util.py6
4 files changed, 13 insertions, 10 deletions
diff --git a/test/functional/rpc_dumptxoutset.py b/test/functional/rpc_dumptxoutset.py
index 39a931be03..4260e95629 100755
--- a/test/functional/rpc_dumptxoutset.py
+++ b/test/functional/rpc_dumptxoutset.py
@@ -52,7 +52,7 @@ class DumptxoutsetTest(BitcoinTestFramework):
# Specifying a path to an existing or invalid file will fail.
assert_raises_rpc_error(
-8, '{} already exists'.format(FILENAME), node.dumptxoutset, FILENAME)
- invalid_path = str(Path(node.datadir) / "invalid" / "path")
+ invalid_path = node.datadir_path / "invalid" / "path"
assert_raises_rpc_error(
-8, "Couldn't open file {}.incomplete for writing".format(invalid_path), node.dumptxoutset, invalid_path)
diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py
index f7765a9dfa..4bab36503c 100644
--- a/test/functional/test_framework/authproxy.py
+++ b/test/functional/test_framework/authproxy.py
@@ -39,6 +39,7 @@ from http import HTTPStatus
import http.client
import json
import logging
+import pathlib
import socket
import time
import urllib.parse
@@ -62,6 +63,8 @@ class JSONRPCException(Exception):
def EncodeDecimal(o):
if isinstance(o, decimal.Decimal):
return str(o)
+ if isinstance(o, pathlib.Path):
+ return str(o)
raise TypeError(repr(o) + " is not JSON serializable")
class AuthServiceProxy():
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index a84eda9b92..a5995b9d37 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -22,7 +22,10 @@ import shlex
import sys
from pathlib import Path
-from .authproxy import JSONRPCException
+from .authproxy import (
+ JSONRPCException,
+ EncodeDecimal,
+)
from .descriptors import descsum_create
from .p2p import P2P_SUBVERSION
from .util import (
@@ -35,7 +38,6 @@ from .util import (
rpc_url,
wait_until_helper,
p2p_port,
- EncodeDecimal,
)
BITCOIND_PROC_WAIT_TIMEOUT = 60
@@ -406,8 +408,12 @@ class TestNode():
conf.write(conf_data)
@property
+ def datadir_path(self) -> Path:
+ return Path(self.datadir)
+
+ @property
def chain_path(self) -> Path:
- return Path(self.datadir) / self.chain
+ return self.datadir_path / self.chain
@property
def debug_log_path(self) -> Path:
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index d3b3e4d536..e480d63e03 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -211,12 +211,6 @@ def check_json_precision():
raise RuntimeError("JSON encode/decode loses precision")
-def EncodeDecimal(o):
- if isinstance(o, Decimal):
- return str(o)
- raise TypeError(repr(o) + " is not JSON serializable")
-
-
def count_bytes(hex_string):
return len(bytearray.fromhex(hex_string))