No description provided.
Port of walletbackup.sh to Python. #5427
pull mrbandrews wants to merge 2 commits into bitcoin:master from mrbandrews:ba-port-walletbackup changing 2 files +200 −297-
mrbandrews commented at 9:27 PM on December 4, 2014: contributor
-
Port of walletbackup.sh to Python. 4eb9eabe4a
-
TheBlueMatt commented at 9:30 PM on December 4, 2014: member
Why?
-
in qa/rpc-tests/walletbackup.py:None in 4eb9eabe4a outdated
28 | +# 1/2/3 are shutdown, and their wallets erased. 29 | +# Then restore using wallet.dat backup. And 30 | +# confirm 1/2/3/4 balances are same as before. 31 | +# 32 | +# Shutdown again, restore using importwallet, 33 | +# and confirm again balances are correct.
kanzure commented at 9:37 PM on December 4, 2014:Could these comments be put into a docstring instead? Importing the file will then reveal these comments in
__doc__.in qa/rpc-tests/walletbackup.py:None in 4eb9eabe4a outdated
35 | + 36 | +from test_framework import BitcoinTestFramework 37 | +from util import * 38 | +from random import randint 39 | + 40 | +class WalletBackupTest (BitcoinTestFramework):
kanzure commented at 9:39 PM on December 4, 2014:nit: line 40 is not very pep8-friendly (even if spacing here is not explicitly defined in pep8). But flake8 or some other pep8-compatible linter isn't being used yet anyway, so you could probably get away this....
in qa/rpc-tests/walletbackup.py:None in 4eb9eabe4a outdated
111 | + assert_equal(self.nodes[0].getbalance(), 50) 112 | + assert_equal(self.nodes[1].getbalance(), 50) 113 | + assert_equal(self.nodes[2].getbalance(), 50) 114 | + assert_equal(self.nodes[3].getbalance(), 0) 115 | + 116 | + print "Creating transactions"
kanzure commented at 9:40 PM on December 4, 2014:Regarding print statements, two thoughts come to mind:
Use
print()so that the file is python3-compatible. I think this will be the only required change, so it's an easy win.An alternative is to not use print at all, and instead use
import loggingand then enable logging to stdout: https://docs.python.org/3/howto/logging.html
mrbandrews commented at 9:51 PM on December 4, 2014: contributorThere's an open issue, #4071, suggesting porting certain tests over, and it seemed like a decent way to get familiar with the subject matter as a new contributor.
gavinandresen commented at 10:04 PM on December 4, 2014: contributorNice! Tested-on-OSX ACK.
laanwj commented at 6:30 AM on December 5, 2014: memberNice. Yes, one of the goals is to port the tests to Python, so that a) they're written in a common language b) theyre not just a bunch of hacky shell scripts that fail on half the machines due to silly path problems.
laanwj added the label Tests on Dec 5, 20141a337105a7Minor edits.
Changed python to python2. Intro comment is now docstring. Replaced print with logging.info. Whitespace edits.
in qa/rpc-tests/walletbackup.py:None in 4eb9eabe4a outdated
0 | @@ -0,0 +1,198 @@ 1 | +#!/usr/bin/env python
laanwj commented at 8:43 AM on December 8, 2014:Please use 'python2' explicitly, we've recently changed this for all tests
laanwj referenced this in commit 09ac7f9e6d on Dec 9, 2014laanwj commented at 10:10 AM on December 9, 2014: memberSquashed+merged via 09ac7f9
laanwj closed this on Dec 10, 2014MarcoFalke locked this on Sep 8, 2021ContributorsLabels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 03:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me