/pytest-cobra

PyTest plugin for testing Smart Contracts for Ethereum blockchain.

Primary LanguagePythonMIT LicenseMIT

PyTest-Cobra PyPI - Python Version

PyTest plugin for testing Smart Contracts for Ethereum blockchain.

GitHub

Requirements

Step 1: Install solc

npm install -g solc

or

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

Step 2: Install PyTest

pip install -U pytest

Step 3: Install plugin PyTest-Cobra

pip install pytest-cobra

Usage

Execute your test suite

1: Testing Solidity file
pytest --cobra Contracts.sol

import_remappings

pytest --cobra Contracts.sol --remapping ["/home/path/dir/"]
2: Testing Contracts Json file

Compile your contracts into a package (soon to be ethPM-compliant)

solc --combined-json abi,bin,bin-runtime contracts/ > Contracts.json

Testing Contracts.json

pytest --cobra Contracts.json
3: Testing Contracts yaml file

Comming soon with Cobra Framework

Further help

PyTest

Go check out the PyTest.

Donation

Donate with Bitcoin Donate with Ethereum