fix config, work on py_tests

This commit is contained in:
protolambda
2019-03-28 02:30:47 +08:00
parent a106edacad
commit ec4d41e15d
13 changed files with 54 additions and 30 deletions

23
py_tests/README.md Normal file
View File

@@ -0,0 +1,23 @@
# ETH 2.0 py-tests
These tests are not intended for client-consumption.
These tests are sanity tests, to verify if the spec itself is consistent.
There are ideas to port these tests to the YAML test suite,
but we are still looking for inputs on how this should work.
## How to run tests
From within the py_tests folder:
Install dependencies:
```bash
python3 -m venv venv
. py_tests/venv/bin/activate
pip3 install -r requirements.txt
```
Run the tests:
```
pytest -m minimal_config .
```

View File

@@ -1,18 +1,17 @@
from copy import deepcopy
import pytest
import build.phase0.spec as spec
import eth2.phase0.spec as spec
from build.phase0.state_transition import (
from eth2.phase0.state_transition import (
state_transition,
)
from build.phase0.spec import (
ZERO_HASH,
from eth2.phase0.spec import (
get_current_epoch,
process_attestation,
slot_to_epoch,
)
from tests.phase0.helpers import (
from ..helpers import (
build_empty_block_for_next_slot,
get_valid_attestation,
)

View File

@@ -2,13 +2,13 @@ from copy import deepcopy
import pytest
from build.phase0.spec import (
from eth2.phase0.spec import (
get_beacon_proposer_index,
cache_state,
advance_slot,
process_block_header,
)
from tests.phase0.helpers import (
from ..helpers import (
build_empty_block_for_next_slot,
)

View File

@@ -1,14 +1,14 @@
from copy import deepcopy
import pytest
import build.phase0.spec as spec
import eth2.phase0.spec as spec
from build.phase0.spec import (
from eth2.phase0.spec import (
get_balance,
ZERO_HASH,
process_deposit,
)
from tests.phase0.helpers import (
from ..helpers import (
build_deposit,
privkeys,
pubkeys,

View File

@@ -1,13 +1,13 @@
from copy import deepcopy
import pytest
import build.phase0.spec as spec
from build.phase0.spec import (
import eth2.phase0.spec as spec
from eth2.phase0.spec import (
get_balance,
get_current_epoch,
process_proposer_slashing,
)
from tests.phase0.helpers import (
from ..helpers import (
get_valid_proposer_slashing,
)

View File

@@ -1,14 +1,14 @@
from copy import deepcopy
import pytest
import build.phase0.spec as spec
import eth2.phase0.spec as spec
from build.phase0.spec import (
from eth2.phase0.spec import (
get_active_validator_indices,
get_current_epoch,
process_voluntary_exit,
)
from tests.phase0.helpers import (
from ..helpers import (
build_voluntary_exit,
pubkey_to_privkey,
)

View File

@@ -1,8 +1,8 @@
import pytest
from build.phase0 import spec
from eth2.phase0 import spec
from tests.phase0.helpers import (
from .helpers import (
create_genesis_state,
)

View File

@@ -2,9 +2,9 @@ from copy import deepcopy
from py_ecc import bls
import build.phase0.spec as spec
from build.phase0.utils.minimal_ssz import signed_root
from build.phase0.spec import (
import eth2.phase0.spec as spec
from eth2.utils.minimal_ssz import signed_root
from eth2.phase0.spec import (
# constants
EMPTY_SIGNATURE,
ZERO_HASH,
@@ -31,7 +31,7 @@ from build.phase0.spec import (
verify_merkle_branch,
hash,
)
from build.phase0.utils.merkle_minimal import (
from eth2.utils.merkle_minimal import (
calc_merkle_tree_from_leaves,
get_merkle_proof,
get_merkle_root,

View File

@@ -3,10 +3,10 @@ from copy import deepcopy
import pytest
from py_ecc import bls
import build.phase0.spec as spec
import eth2.phase0.spec as spec
from build.phase0.utils.minimal_ssz import signed_root
from build.phase0.spec import (
from eth2.utils.minimal_ssz import signed_root
from eth2.phase0.spec import (
# constants
EMPTY_SIGNATURE,
ZERO_HASH,
@@ -27,15 +27,15 @@ from build.phase0.spec import (
verify_merkle_branch,
hash,
)
from build.phase0.state_transition import (
from eth2.phase0.state_transition import (
state_transition,
)
from build.phase0.utils.merkle_minimal import (
from eth2.utils.merkle_minimal import (
calc_merkle_tree_from_leaves,
get_merkle_proof,
get_merkle_root,
)
from tests.phase0.helpers import (
from .helpers import (
build_deposit_data,
build_empty_block_for_next_slot,
force_registry_change_at_next_epoch,

View File

@@ -4,3 +4,4 @@ oyaml==0.7
pycryptodome==3.7.3
py_ecc>=1.6.0
pytest>=3.6,<3.7
../pyspec