Skip to content

Commit

Permalink
Minor adjustments from pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
njgheorghita committed Nov 28, 2018
1 parent 834b958 commit 71a904c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/web3.pm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Package Manager API
The ``web3.pm`` object exposes methods to interact with Packages as defined by `ERC 1123 <https://github.com/ethereum/EIPs/issues/1123>`_.

To learn more about the EthPM spec, visit the `documentation <http://ethpm.github.io/ethpm-spec/>`__.
To learn more about the Py-EthPM library used in this module, visit the `documentation <https://py-ethpm.readthedocs.io/en/latest/>`__.


Attaching
Expand Down
7 changes: 5 additions & 2 deletions tests/core/pm-module/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(message)s")


def w3():
def setup_w3():
genesis_overrides = {"gas_limit": 5500000}
custom_genesis_params = PyEVMBackend._generate_genesis_params(
overrides=genesis_overrides
Expand Down Expand Up @@ -219,7 +219,10 @@ def release_packages(registry):
return registry


W3 = w3()
# Module-level variables used here for efficiency
# Tests are written against the sample packages released in `release_packages()` above, if more
# tests are needed, they should take into account the releases that exist on a "loaded registry".
W3 = setup_w3()
FRESH_VY_REGISTRY = vy_registry(W3)
FRESH_SOL_REGISTRY = sol_registry(W3)
LOADED_VY_REGISTRY = release_packages(vy_registry(W3))
Expand Down
11 changes: 5 additions & 6 deletions tests/core/pm-module/test_ens_integration.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import pytest

from eth_utils import (
to_bytes,
to_canonical_address,
)
from ethpm import (
ASSETS_DIR,
)

from ens import ENS
from web3 import Web3
from web3.exceptions import (
InvalidAddress,
)
Expand All @@ -20,13 +20,10 @@

def bytes32(val):
if isinstance(val, int):
result = Web3.toBytes(val)
result = to_bytes(val)
else:
raise TypeError('val %r could not be converted to bytes')
if len(result) < 32:
return result.rjust(32, b'\0')
else:
return result
return result.rjust(32, b'\0')


pytest_plugins = ["pytest_ethereum.plugins"]
Expand All @@ -46,6 +43,8 @@ def ens_setup(solc_deployer):
ens_key = accounts.pop()

# create ENS contract
# values borrowed from:
# https://github.com/ethereum/web3.py/blob/master/tests/ens/conftest.py#L109
eth_labelhash = w3.keccak(text='eth')
eth_namehash = bytes32(0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae)
resolver_namehash = bytes32(0xfdd5d5de6dd63db72bbc2d487944ba13bf775b50a80805fe6fcaba9b0fba88f5)
Expand Down

0 comments on commit 71a904c

Please sign in to comment.