Skip to main content

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:

  1. Ensure you have Python 3.12+

  2. Install AlgoKit CLI

  3. Install Algorand Python Testing into your project:

    pip install algorand-testing-python
    
  4. 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
    
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algorand_python_testing-0.3.0b4.tar.gz (244.9 kB view details)

Uploaded Source

Built Distribution

algorand_python_testing-0.3.0b4-py3-none-any.whl (82.6 kB view details)

Uploaded Python 3

File details

Details for the file algorand_python_testing-0.3.0b4.tar.gz.

File metadata

File hashes

Hashes for algorand_python_testing-0.3.0b4.tar.gz
Algorithm Hash digest
SHA256 23561837d3e883e7f6c8d68c4e1af6353101cb9bcd5f4a557a5d9d133301f5d1
MD5 a5dbda18dc4d02ccc6d7831736ea50df
BLAKE2b-256 d34a4e0116dfc2dd3ebd3452d57c0537ad7e1a65c1bd0b10834b008f11e29c54

See more details on using hashes here.

File details

Details for the file algorand_python_testing-0.3.0b4-py3-none-any.whl.

File metadata

File hashes

Hashes for algorand_python_testing-0.3.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 3e74e84118b39f8b144525a1db89124b97e012787e315b8e2819d5886969d26b
MD5 393655a6d42f32d643d956694299dea9
BLAKE2b-256 1451cf65321107fb1840e73c7bbc9f94bccb6911601f16a4b15b143aa5226d7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page