A canister testing library
Project description
PocketIC: A Canister Testing Platform
PocketIC is a local canister testing platform for the Internet Computer.
It consists of the PocketIC binary, which handles different IC instances, and a Python library (this repo) which allows you to interact with your local IC instances and the canisters thereon.
With PocketIC, you can test your canisters with just a few lines of Python code, either by interacting with an IC instance:
from pocket_ic import PocketIC
pic = PocketIC()
canister_id = pic.create_canister()
# use PocketIC to interact with your canisters
pic.add_cycles(canister_id, 1_000_000)
response = pic.update_call(canister_id, method="greeting", ...)
assert(response == 'Hello, PocketIC!')
... or even directly with a canister object:
my_canister = pic.create_and_install_canister_with_candid(...)
# call your canister functions with native Python syntax
respone = my_canister.greeting()
assert(response == 'Hello, PocketIC!')
Getting Started
Quickstart
- Download the PocketIC binary for Linux or macOS.
- Make sure the binary is available through your
$PATH
variable; you can verify that everything works by callingpocket-ic --help
from your terminal. - Run
python3 -m pip install pocket_ic
in your (virtual) environment to get the Python library. - Use
from pocket_ic import PocketIC
in your Python code and start testing!
For a more detailed installation guide, see INSTALLATION.md.
Examples
To see some working code, see the examples folder, or check out the how to use this library guide.
Documentation
Contributing
See CONTRIBUTING.md
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
Built Distribution
File details
Details for the file pocket_ic-0.1.0.tar.gz
.
File metadata
- Download URL: pocket_ic-0.1.0.tar.gz
- Upload date:
- Size: 583.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ada5ba1103cfe0df62f7fb641e64012ff777f4668e4912f670dc7707b9e19f3 |
|
MD5 | eb06f6b1337065d68030849e57098e48 |
|
BLAKE2b-256 | c7b08a1d8c5700e2f5b7caf1b949b7f5e9c1fb60ae3fa3652e9913978d2b1e82 |
Provenance
File details
Details for the file pocket_ic-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pocket_ic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7011c1a200a5d14338b26d1cd4d9134d6ac2a71130c1e3746b836c0d9623421 |
|
MD5 | 32210240d14f345d70eb2ef7141a0a58 |
|
BLAKE2b-256 | d2d211c2e8003ee4ffb363d3ecfa1f96407dc8e1fb2aa03f77d84e1313b8edc9 |