mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
test: Use pathlib over os.path #28362
revert netutil chgs py3.8 compliant fixes based on PR review
This commit is contained in:
@@ -10,7 +10,7 @@ To generate that file this test uses the helper scripts available
|
||||
in contrib/linearize.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -32,10 +32,10 @@ class LoadblockTest(BitcoinTestFramework):
|
||||
self.generate(self.nodes[0], COINBASE_MATURITY, sync_fun=self.no_op)
|
||||
|
||||
# Parsing the url of our node to get settings for config file
|
||||
data_dir = self.nodes[0].datadir
|
||||
data_dir = self.nodes[0].datadir_path
|
||||
node_url = urllib.parse.urlparse(self.nodes[0].url)
|
||||
cfg_file = os.path.join(data_dir, "linearize.cfg")
|
||||
bootstrap_file = os.path.join(self.options.tmpdir, "bootstrap.dat")
|
||||
cfg_file = data_dir / "linearize.cfg"
|
||||
bootstrap_file = Path(self.options.tmpdir) / "bootstrap.dat"
|
||||
genesis_block = self.nodes[0].getblockhash(0)
|
||||
blocks_dir = self.nodes[0].blocks_path
|
||||
hash_list = tempfile.NamedTemporaryFile(dir=data_dir,
|
||||
@@ -58,16 +58,16 @@ class LoadblockTest(BitcoinTestFramework):
|
||||
cfg.write(f"hashlist={hash_list.name}\n")
|
||||
|
||||
base_dir = self.config["environment"]["SRCDIR"]
|
||||
linearize_dir = os.path.join(base_dir, "contrib", "linearize")
|
||||
linearize_dir = Path(base_dir) / "contrib" / "linearize"
|
||||
|
||||
self.log.info("Run linearization of block hashes")
|
||||
linearize_hashes_file = os.path.join(linearize_dir, "linearize-hashes.py")
|
||||
linearize_hashes_file = linearize_dir / "linearize-hashes.py"
|
||||
subprocess.run([sys.executable, linearize_hashes_file, cfg_file],
|
||||
stdout=hash_list,
|
||||
check=True)
|
||||
|
||||
self.log.info("Run linearization of block data")
|
||||
linearize_data_file = os.path.join(linearize_dir, "linearize-data.py")
|
||||
linearize_data_file = linearize_dir / "linearize-data.py"
|
||||
subprocess.run([sys.executable, linearize_data_file, cfg_file],
|
||||
check=True)
|
||||
|
||||
|
Reference in New Issue
Block a user