def test_custom_virtual_machines(): if not is_pyevm_available(): pytest.skip("PyEVM is not available") backend = PyEVMBackend(vm_configuration=( (0, FrontierVM), (3, BerlinVM), )) # This should be a FrontierVM block VM_at_2 = backend.chain.get_vm_class_for_block_number(2) # This should be a BerlinVM block VM_at_3 = backend.chain.get_vm_class_for_block_number(3) assert issubclass(VM_at_2, FrontierVM) assert not issubclass(VM_at_2, BerlinVM) assert issubclass(VM_at_3, BerlinVM) # Right now, just test that EthereumTester doesn't crash # Maybe some more sophisticated test to make sure the VMs are set correctly? # We should to make sure the VM config translates all the way to the main # tester, maybe with a custom VM that hard-codes some block value? that can # be found with tester.get_block_by_number()? EthereumTester(backend=backend)
def eth_tester(): if not is_pyevm_available(): pytest.skip("PyEVM is not available") backend = PyEVMBackend() return EthereumTester(backend=backend)