balpy
balpy copied to clipboard
Tests
There are no tests written for this library. That seems dangerous. I would be happy to start contributing tests. I'm still trying to get a sample running.
Unit tests for balpy have been deprioritized since many of the test cases would involve deploying contracts to specific chains, which would clutter the testnet UIs, cost money on production networks, and require maintaining native asset balances on various chains. Not impossible, but pretty tedious.
Doing the tests locally would require integrating brownie which honestly would be amazing, but it would be a significant undertaking that I don't have time for right now
Do you think it could be done using ApeworkX instead of Brownie?
https://docs.apeworx.io/ape/stable/userguides/testing.html
I would be interested in making this kind of contribution to the repo.
I've heard to ApeworkX but have never gone down the rabbit hole. If we were to move in that direction, we would definitely need to add all the bytecode and ABIs back in. I had previously removed them to make the package more lightweight
I think bytecode and ABIs could be gitignored. The package could stay as is, add ape-eth as a dependency, and compile contracts on the fly when running tests...
@gerrrg Automated unit tests can be implemented by stubbing out external behaviors using pytest. I think it would be of value to test the internal logic of this library, not necessarily the smart contracts or other external behaviors.
@LinuxIsCool
I have a nice stable env up and running here;
https://github.com/balancer/balpy/pull/55
We can use a local fork from a specific block for tests.
See this suite here;
https://github.com/8ball030/rysk_explorations/blob/5a83dabf0043c174bf553172acc7c7661069fc01/tests/test_contract_calls.py#L44