Changeset View
Changeset View
Standalone View
Standalone View
test/functional/example_test.py
Show All 24 Lines | from test_framework.mininode import ( | ||||
msg_getdata, | msg_getdata, | ||||
) | ) | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
connect_nodes, | connect_nodes, | ||||
wait_until, | wait_until, | ||||
) | ) | ||||
from test_framework.decorators import * | |||||
# NodeConnCB is a class containing callbacks to be executed when a P2P | # NodeConnCB is a class containing callbacks to be executed when a P2P | ||||
# message is received from the node-under-test. Subclass NodeConnCB and | # message is received from the node-under-test. Subclass NodeConnCB and | ||||
# override the on_*() methods if you need custom behaviour. | # override the on_*() methods if you need custom behaviour. | ||||
class BaseNode(NodeConnCB): | class BaseNode(NodeConnCB): | ||||
def __init__(self): | def __init__(self): | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# The network thread uses a global lock on data access to the NodeConn objects when sending and receiving | # The network thread uses a global lock on data access to the NodeConn objects when sending and receiving | ||||
# messages. The test thread should acquire the global lock before accessing any NodeConn data to avoid locking | # messages. The test thread should acquire the global lock before accessing any NodeConn data to avoid locking | ||||
# and synchronization issues. Note wait_until() acquires this global lock when testing the predicate. | # and synchronization issues. Note wait_until() acquires this global lock when testing the predicate. | ||||
with mininode_lock: | with mininode_lock: | ||||
for block in node2.block_receive_map.values(): | for block in node2.block_receive_map.values(): | ||||
assert_equal(block, 1) | assert_equal(block, 1) | ||||
@tags('fast') | |||||
@nodes([], ["-logips"], []) | |||||
@test_case("NamedTest") | |||||
@clean_chain() | |||||
def NamedTest(self): | |||||
print("hello world") | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
ExampleTest().main() | ExampleTest().main() |