{"library":"pytest-wake","title":"pytest-wake","description":"pytest-wake is a pytest plugin that integrates the Wake Solidity development and fuzz testing framework with the pytest testing framework. It enables writing tests for Solidity smart contracts using Python, leveraging pytest's capabilities and Wake's `pytypes` for type-safe interactions. The current version is 0.4.3, released on November 19, 2024. While specific release cadence details for `pytest-wake` are not explicitly stated, its development is tied to the active Wake framework.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pytest-wake eth-wake"],"cli":null},"imports":["import pytest","from pytypes.contracts.MyContract import MyContract"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nimport os\n\n# Assuming a file `contracts/MyContract.sol` exists with a simple contract:\n# pragma solidity ^0.8.0;\n# contract MyContract {\n#   uint public value;\n#   constructor(uint _value) { value = _value; }\n#   function setValue(uint _newValue) public { value = _newValue; }\n# }\n\n# You would typically run 'wake init' and 'wake pytypes' in your project root\n# to generate the 'pytypes' directory before running tests.\n# For example: wake init --force; wake pytypes -w\n\n# These imports would be generated by 'wake pytypes'\n# For this example, we'll assume a basic contract structure and manual pytype creation\n# In a real scenario, Wake's CLI would manage this.\n# To make this runnable without `wake pytypes` output, we will mock the contract interaction slightly.\n\ntry:\n    from pytypes.contracts.MyContract import MyContract\n    # In a real setup, you'd also need a 'default_chain' fixture provided by Wake\n    # For demonstration, we'll simulate contract deployment and interaction.\n    class MockContract:\n        def __init__(self, value):\n            self._value = value\n        \n        @property\n        def value(self):\n            return self._value\n            \n        def setValue(self, new_value):\n            self._value = new_value\n            return self # Simulate fluent interface\n\n    # This fixture would typically be provided by Wake\n    @pytest.fixture\n    def deployed_my_contract():\n        # In a real Wake test, this would deploy your contract to a chain\n        # and return the pytype instance connected to it.\n        return MockContract(10)\n\n    def test_my_contract_initial_value(deployed_my_contract):\n        assert deployed_my_contract.value == 10\n\n    def test_my_contract_set_value(deployed_my_contract):\n        deployed_my_contract.setValue(20)\n        assert deployed_my_contract.value == 20\n\nexcept ImportError:\n    print(\"Skipping contract tests: 'pytypes' not generated or Wake environment not set up.\")\n    print(\"Please run 'wake init' and 'wake pytypes -w' in your project directory.\")\n    def test_placeholder_contract():\n        pytest.skip(\"Contract pytypes not available, Wake environment not set up.\")\n\n","lang":"python","description":"This quickstart demonstrates how to set up a basic `pytest` test for a Solidity smart contract using the `Wake` framework. First, create a `contracts/MyContract.sol` file with a simple Solidity contract. Then, initialize a Wake project and generate Python `pytypes` by running `wake init` and `wake pytypes -w` in your project's root directory. These commands set up the project structure and create Python classes (pytypes) that represent your Solidity contracts, enabling type-safe interaction. Finally, write a `pytest` test file (e.g., `test_my_contract.py`) that imports and uses these generated pytypes to interact with and assert properties of your deployed contract.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"0.4.3","pypi_latest":"0.4.3","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":80,"avg_install_s":19.9,"avg_import_s":0.41,"wheel_type":"sdist"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.42,"mem_mb":11,"disk_size":"171.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":20.5,"import_time_s":0.27,"mem_mb":11,"disk_size":"176M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.53,"mem_mb":11.6,"disk_size":"179.4M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":18.1,"import_time_s":0.46,"mem_mb":11.6,"disk_size":"184M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.48,"mem_mb":11.5,"disk_size":"175.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":18.2,"import_time_s":0.49,"mem_mb":11.5,"disk_size":"180M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-wake","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-wake","exit_code":1,"wheel_type":null,"failure_reason":"build_error","import_side_effects":null,"install_time_s":11.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.33,"mem_mb":10.1,"disk_size":"139.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-wake","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":22.7,"import_time_s":0.29,"mem_mb":10.1,"disk_size":"144M"}]}}