mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
contrib: testgen: avoid need for manually setting PYTHONPATH
This commit is contained in:
parent
7b83c7d609
commit
7d755bb31c
2 changed files with 11 additions and 9 deletions
|
@ -4,5 +4,5 @@ Utilities to generate test vectors for the data-driven Bitcoin tests.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json
|
./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json
|
||||||
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json
|
./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2012-2021 The Bitcoin Core developers
|
# Copyright (c) 2012-2022 The Bitcoin Core developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
'''
|
'''
|
||||||
Generate valid and invalid base58/bech32(m) address and private key test vectors.
|
Generate valid and invalid base58/bech32(m) address and private key test vectors.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json
|
./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json
|
||||||
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json
|
./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json
|
||||||
'''
|
'''
|
||||||
# 2012 Wladimir J. van der Laan
|
|
||||||
# Released under MIT License
|
|
||||||
import os
|
import os
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
from base58 import b58encode_chk, b58decode_chk, b58chars
|
from base58 import b58encode_chk, b58decode_chk, b58chars
|
||||||
import random
|
import random
|
||||||
from segwit_addr import bech32_encode, decode_segwit_address, convertbits, CHARSET, Encoding
|
import sys
|
||||||
|
|
||||||
|
sys.path.append(os.path.join(os.path.dirname(__file__), '../../test/functional'))
|
||||||
|
|
||||||
|
from test_framework.segwit_addr import bech32_encode, decode_segwit_address, convertbits, CHARSET, Encoding # noqa: E402
|
||||||
|
|
||||||
# key types
|
# key types
|
||||||
PUBKEY_ADDRESS = 0
|
PUBKEY_ADDRESS = 0
|
||||||
|
@ -250,7 +253,6 @@ def gen_invalid_vectors():
|
||||||
yield val,
|
yield val,
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
|
||||||
import json
|
import json
|
||||||
iters = {'valid':gen_valid_vectors, 'invalid':gen_invalid_vectors}
|
iters = {'valid':gen_valid_vectors, 'invalid':gen_invalid_vectors}
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue