Skip to content

test.py fails in a number of locations #3

@Mahedros

Description

@Mahedros

The blockchain itself does appear to be running successfully on my system, but I've run into a number of problems when I run the tests.

  • The hashes in test.py all use 5 leading zeroes, but the default value in config.py is 6.
  • The with statements on lines 106, 110, 114, and 117 make use of the variables zt, ft, st, and tt, but these variables are not defined until lines 125-128
  • Calls to mine.mine_block and mine.mine_from_prev_block fail with ValueError: too many values to unpack, since both return 4 values and test.py tries to assign the results to only 3 variables

All of these are relatively simple fixes, but after I dealt with them I ran into a problem to which the solution was less obvious.

Traceback (most recent call last):  
  File "test.py", line 167, in <module>
    assert new_block == mine_test_block_one
  File "C:\Users\mgplante\blockchain\jbc2\block.py", line 67, in __eq__
    return (self.index == other.index and
AttributeError: 'NoneType' object has no attribute 'index'

It's failing to find a block when the tests assert that it should find a block.

The fact that I'm able to run nodes successfully implies to me that everything is working and that it's just the tests that are wrong, but it's not clear to me how one would go about fixing that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions