Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 4e2eba3

Browse files
committed
Changed fixtures submodule commit in order to pass transaction tests. Fixed the difficulty tests.
1 parent 1b0d003 commit 4e2eba3

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

ethereum/tests/test_difficulty.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,19 @@ def test_difficulty(filename, testname, testdata):
2525
reference_dif = int(testdata["currentDifficulty"], 10 if testdata["currentDifficulty"].isdigit() else 16)
2626

2727

28+
env = tester.state().env
29+
if 'Homestead' in filename:
30+
env.config['HOMESTEAD_FORK_BLKNUM'] = 0
31+
if 'difficultyMorden' in filename:
32+
env.config['HOMESTEAD_FORK_BLKNUM'] = 494000
33+
2834
parent_bh = blocks.BlockHeader(timestamp=parent_timestamp,
2935
difficulty=parent_difficulty,
3036
number=parent_blk_number)
31-
block = blocks.Block(parent_bh, [], env=tester.state().env,
37+
block = blocks.Block(parent_bh, [], env=env,
3238
making=True)
3339

40+
3441
calculated_dif = blocks.calc_difficulty(block, cur_blk_timestamp)
3542

3643
print calculated_dif

ethereum/testutils.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,19 @@ def generate_test_params(testsource, metafunc, skip_func=None, exclude_func=None
576576
base_dir = os.path.dirname(os.path.dirname(__file__))
577577
params = []
578578
for filename, tests in fixtures.items():
579-
filename = os.path.relpath(filename, base_dir)
580-
for testname, testdata in tests.items():
581-
if exclude_func and exclude_func(filename, testname, testdata):
582-
continue
583-
if skip_func:
584-
skipif = pytest.mark.skipif(
585-
skip_func(filename, testname, testdata),
586-
reason="Excluded"
587-
)
588-
params.append(skipif((filename, testname, testdata)))
589-
else:
590-
params.append((filename, testname, testdata))
579+
if isinstance(tests, dict):
580+
filename = os.path.relpath(filename, base_dir)
581+
for testname, testdata in tests.items():
582+
if exclude_func and exclude_func(filename, testname, testdata):
583+
continue
584+
if skip_func:
585+
skipif = pytest.mark.skipif(
586+
skip_func(filename, testname, testdata),
587+
reason="Excluded"
588+
)
589+
params.append(skipif((filename, testname, testdata)))
590+
else:
591+
params.append((filename, testname, testdata))
591592

592593
metafunc.parametrize(
593594
('filename', 'testname', 'testdata'),

fixtures

Submodule fixtures updated 33 files

0 commit comments

Comments
 (0)