Skip to content

Cannot run multiple instances of TestWrapper #20

@jachiang

Description

@jachiang

Running setup() on multiple instances of TestWrapper results in a AssertionError:

>>> test = util.TestWrapper()
>>> test2 = util.TestWrapper()
>>> test.setup()
2019-09-13T18:08:04.389000Z TestFramework./var/folders/x6/74wk_20d3t90825bykj23y780000gn/T/bitcoin_func_test_0hnz1ze_ (INFO): Initializing test directory /var/folders/x6/74wk_20d3t90825bykj23y780000gn/T/bitcoin_func_test_0hnz1ze_
>>> test2.setup()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jamesc/Dropbox/repos/taproot/util.py", line 83, in setup
    super(TestWrapper,self).setup()
  File "/Users/jamesc/Dropbox/repos/test/bitcoin/test/functional/test_framework/test_framework.py", line 196, in setup
    self.network_thread = NetworkThread()
  File "/Users/jamesc/Dropbox/repos/test/bitcoin/test/functional/test_framework/mininode.py", line 469, in __init__
    assert not self.network_event_loop
AssertionError

This occurs because we are initialising a network thread twice. Initialising with a different thread for each TestWrapper object requires refactor of NetworkThread class in mininode.py.

This has been added as a todo to the TestFramework main method refactor PR.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions