Open artemistomaras opened 6 years ago
Are you by any chance sharing the setUpTestData
method between your two test cases through inheritance?
@dylanjw no. My two test cases reside in different files with a setUpTestData
in each one.
After more fiddling around I found the following:
-r
flag) I still get the same issue--parallel
flag), my test get executed without an issue(uport_relay_server) artemis@artemis-pc:~/PycharmProjects/uport_relay_server$ python3 manage.py test --parallel --settings=uport_relay_server.settings.test
Failed to import bitcoin. This is not a fatal error but does
mean that you will not be able to determine the address from
your wallet file.
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
System check identified no issues (0 silenced).
Initializing chain from provided state
Initializing chain from provided state
Initializing chain from provided state
Initializing chain from provided state
INFO:eth.block Block pre-sealed, 21000 gas used
INFO:eth.block Block pre-sealed, 21000 gas used
INFO:eth.chain Adding to head head=c6745cf3
INFO:eth.chain Adding to head head=c6745cf3
Saved 3 address change logs
Saved 3 address change logs
INFO:eth.chain Added block 1 (211e11df) with 1 txs and 21000 gas
INFO:eth.chain Added block 1 (211e11df) with 1 txs and 21000 gas
INFO:eth.block Block pre-sealed, 470791 gas used
INFO:eth.block Block pre-sealed, 470791 gas used
INFO:eth.chain Adding to head head=211e11df
INFO:eth.chain Adding to head head=211e11df
Saved 2 address change logs
INFO:eth.chain Added block 2 (404f8090) with 1 txs and 470791 gas
Saved 2 address change logs
INFO:eth.chain Added block 2 (404f8090) with 1 txs and 470791 gas
INFO:eth.block Block pre-sealed, 1641161 gas used
INFO:eth.block Block pre-sealed, 1641161 gas used
INFO:eth.chain Adding to head head=404f8090
INFO:eth.chain Adding to head head=404f8090
Saved 2 address change logs
INFO:eth.chain Added block 3 (c5ab0a92) with 1 txs and 1641161 gas
Saved 2 address change logs
INFO:eth.chain Added block 3 (c5ab0a92) with 1 txs and 1641161 gas
INFO:eth.block Block pre-sealed, 505467 gas used
INFO:eth.block Block pre-sealed, 505467 gas used
INFO:eth.chain Adding to head head=c5ab0a92
INFO:eth.chain Adding to head head=c5ab0a92
Saved 2 address change logs
INFO:eth.chain Added block 4 (4c0ccfe2) with 1 txs and 505467 gas
Saved 2 address change logs
INFO:eth.chain Added block 4 (4c0ccfe2) with 1 txs and 505467 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
INFO:eth.block Block pre-sealed, 283526 gas used
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
INFO:eth.block Block pre-sealed, 283526 gas used
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 98148 gas used
INFO:eth.chain Adding to head head=51fb8023
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 7 address change logs
INFO:eth.chain Added block 6 (288e4f20) with 1 txs and 98148 gas
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 98148 gas used
INFO:eth.chain Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain Added block 6 (288e4f20) with 1 txs and 98148 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
INFO:eth.block Block pre-sealed, 98148 gas used
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.chain Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain Added block 6 (288e4f20) with 1 txs and 98148 gas
INFO:eth.block Block pre-sealed, 283526 gas used
INFO:eth.chain Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block Block pre-sealed, 98148 gas used
INFO:eth.chain Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain Added block 6 (288e4f20) with 1 txs and 98148 gas
......INFO:eth.block Block pre-sealed, 98148 gas used
INFO:eth.chain Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain Added block 6 (288e4f20) with 1 txs and 98148 gas
......
----------------------------------------------------------------------
Ran 12 tests in 2.353s
OK
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
@artemistomaras Do you get the same issue using the PyEVMBackend
instead of the PyEthereum21Backend
? The fact that running with the --parallel works seems to indicate something is getting screwed up by running the two test cases in the same process. Can you set a break point before the failure, and poke around to see if the chain state is what you would expect at that point in the test? Do any transactions submitted at the break point remain unmined, or is it just the one that is getting lost?
Suppose the following django project structure:
Also suppose the following
TestCase
setup for both test files:Below is the output of running each TestCase on its own:
and for the api tests:
Everything looks ok. The problem appears when I try to run both test cases at once, using a single
python3 manage.py test
command.What will happen is that inside my code, a call to
web3.eth.waitForTransactionReceipt
will always timeout or, a call toEthereumTester.get_transaction_receipt
will always raise aTransactionNotFound
Below is the output of executing both test cases together, and me pressing ctrl+c to terminate when the call to
web3.eth.waitForTransactionReceipt
blocks ( setting the timeout to 1 second for example will just make all my unit tests fail )