def test_compilation_does_not_crash(): OWN_DIR = os.path.dirname(os.path.realpath(__file__)) def path(relative_path): joined = os.path.join(OWN_DIR, relative_path) return os.path.abspath(os.path.realpath(joined)) builder = Builder(path('../priv'), path('../priv/build')) builder.compile_all()
from tests.tests_utils.plasma_framework import PlasmaFramework # IMPORTANT NOTICE # Whenever we pass to or receive from web3 an address, we do it in checksum format. # On the other hand, in plasma (transactions, blocks, etc.) we should pass addresses in binary form (canonical address). # Compile contracts before testing OWN_DIR = os.path.dirname(os.path.realpath(__file__)) CONTRACTS_DIR = os.path.abspath( os.path.realpath(os.path.join(OWN_DIR, '../../contracts'))) OUTPUT_DIR = os.path.abspath( os.path.realpath(os.path.join(OWN_DIR, '../build'))) OPENZEPPELIN_DIR = os.path.abspath( os.path.realpath(os.path.join(OWN_DIR, '../openzeppelin-solidity'))) builder = Builder(CONTRACTS_DIR, OUTPUT_DIR) builder.compile_all( allow_paths="*,", import_remappings=[f"openzeppelin-solidity={OPENZEPPELIN_DIR}"], optimize=True, optimize_runs=200) deployer = Deployer(builder) @pytest.fixture(scope="session") def accounts(): _accounts = [] for i in range(1, 11): pk = PrivateKey(i.to_bytes(32, byteorder='big')) _accounts.append( EthereumAccount(pk.public_key.to_checksum_address(), pk))
from solc_simple import Builder from testlang.testlang import TestingLanguage from solc import link_code EXIT_PERIOD = 4 * 60 # 4 minutes GAS_LIMIT = 10000000 START_GAS = GAS_LIMIT - 1000000 config_metropolis['BLOCK_GAS_LIMIT'] = GAS_LIMIT # Compile contracts before testing OWN_DIR = os.path.dirname(os.path.realpath(__file__)) CONTRACTS_DIR = os.path.abspath( os.path.realpath(os.path.join(OWN_DIR, '../contracts'))) OUTPUT_DIR = os.path.abspath( os.path.realpath(os.path.join(OWN_DIR, '../build'))) builder = Builder(CONTRACTS_DIR, OUTPUT_DIR) builder.compile_all() deployer = Deployer(builder) def pytest_addoption(parser): parser.addoption("--runslow", action="store_true", default=False, help="run slow tests") def pytest_collection_modifyitems(config, items): if config.getoption("--runslow"): # --runslow given in cli: do not skip slow tests return