Algorand Python testing library
Project description
Algorand Python Testing is a companion package to Algorand Python that enables efficient unit testing of Algorand Python smart contracts in an offline environment. It emulates key AVM behaviors without requiring a network connection, offering fast and reliable testing capabilities with a familiar Pythonic interface.
Documentation | Algorand Python Documentation
Quick start
The easiest way to use Algorand Python Testing is to instantiate a template with AlgoKit via algokit init -t python
. This will give you a full development environment with testing capabilities built-in.
Alternatively, if you want to start from scratch:
-
Ensure you have Python 3.12+
-
Install AlgoKit CLI
-
Install Algorand Python Testing into your project:
pip install algorand-testing-python
-
Create a test file (e.g.,
test_contract.py
):from algopy_testing import algopy_testing_context from your_contract import YourContract def test_your_contract(): with algopy_testing_context() as ctx: contract = YourContract() # Your test code here
-
Run your tests using your preferred Python testing framework (e.g., pytest, unittest)
For more detailed information, check out the full documentation.
Features
- Offline testing environment simulating core AVM functionality
- Compatible with popular Python testing frameworks
- Supports testing of ARC4 contracts, smart signatures, and more
- Provides tools for mocking blockchain state and transactions
Examples
For detailed examples showcasing various testing scenarios, refer to the examples section in the documentation.
Contributing
We welcome contributions to this project! Please read our contributing guide to get started.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for algorand_python_testing-0.3.0b3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b13085bf85ab4d1e49aee3052842f23b03e67df94342d5973c26f5a2310ca9 |
|
MD5 | 5db0b41a615ba7eda27697296b52d8df |
|
BLAKE2b-256 | c67a7d5254ffd9f69ca0f3fcdcca9c96f5fab0db5e09407ff7c267002d074922 |
Hashes for algorand_python_testing-0.3.0b3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 548b60f308eb05fd5dd0d3762d0855ac62323e71c26e552d6a2e67548accf9c8 |
|
MD5 | 204abe7c2f6c8a7e77784f188afb07df |
|
BLAKE2b-256 | 96b5150b7f668fd7a55f50b3a7dcc4df2113942e6b0a889f2d694ca942a411fa |