aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2020-10-21 13:06:34 -0700
committerMarcoFalke <falke.marco@gmail.com>2020-11-03 12:26:17 +0100
commit50eb0c2512842b96a0128a7d592a357665f6e006 (patch)
tree92b888a5df6d3494cea4eba9dc012803948d2b4d /test/functional/test_framework
parentfac865b72d5c0e01fce74b84ab21e5ebbf069327 (diff)
downloadbitcoin-50eb0c2512842b96a0128a7d592a357665f6e006.tar.xz
Small improvements to the Taproot functional tests
The "whitelist" and "connect_nodes" is not needed in feature_taproot.py, so remove it. The changes to key.py are required when running the unit tests from the test folder. Failure on current master: [test]$ python -m unittest functional/test_framework/key.py .E ====================================================================== ERROR: test_schnorr_testvectors (functional.test_framework.key.TestFrameworkKey) Implement the BIP340 test vectors (read from bip340_test_vectors.csv). ---------------------------------------------------------------------- Traceback (most recent call last): File "test/functional/test_framework/key.py", line 526, in test_schnorr_testvectors with open(os.path.join(sys.path[0], 'test_framework', 'bip340_test_vectors.csv'), newline='', encoding='utf8') as csvfile: FileNotFoundError: [Errno 2] No such file or directory: 'test/test_framework/bip340_test_vectors.csv' ---------------------------------------------------------------------- Ran 2 tests in 0.775s FAILED (errors=1)
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/key.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/functional/test_framework/key.py b/test/functional/test_framework/key.py
index a6bc187985..64e82e614c 100644
--- a/test/functional/test_framework/key.py
+++ b/test/functional/test_framework/key.py
@@ -10,7 +10,6 @@ import csv
import hashlib
import os
import random
-import sys
import unittest
from .util import modinv
@@ -22,6 +21,7 @@ def TaggedHash(tag, data):
return hashlib.sha256(ss).digest()
def xor_bytes(b0, b1):
+ assert len(b0) == len(b1)
return bytes(x ^ y for (x, y) in zip(b0, b1))
def jacobi_symbol(n, k):
@@ -523,7 +523,8 @@ class TestFrameworkKey(unittest.TestCase):
def test_schnorr_testvectors(self):
"""Implement the BIP340 test vectors (read from bip340_test_vectors.csv)."""
num_tests = 0
- with open(os.path.join(sys.path[0], 'test_framework', 'bip340_test_vectors.csv'), newline='', encoding='utf8') as csvfile:
+ vectors_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'bip340_test_vectors.csv')
+ with open(vectors_file, newline='', encoding='utf8') as csvfile:
reader = csv.reader(csvfile)
next(reader)
for row in reader: