Uses pytest-order to control the order of tests and break them into more manageable chunks
refactor(network.py): Changes the insecure status to be loaded dynamically with an is_insecure property
test: adds an env var, "USE_LOCALNET" that lets you test against custom networks. Tests default to using the "devnet".
test: favors using sdk_val or sdk_oracle over sdk_agent so that less transfers are required.
test: Implements a tests.raises function that has better UX than pytest.raises. See perp_test.py or dex_test.py for some examples.
Tests on the dex and perp module are more forgiving in that they don't depend as much on the initial state.
For example, if you run perp_test.py and the position is underwater, open, add, remove, and close transactions should fail, but only in a very specific way. The query should happy path, while open, add, and remove should fail with "bad debt", and close should fail with an "underwater" error.
Another example, when you run dex_test.py, create pool should only happy path the first time. After that, it should give the "same denom" error. But if you create a pool without enough NIBI in your wallet, the create pool test will pass, but all of the other dex tests will fail, and the error messages will be super informative for debugging.
Other notable changes
test(event): test parse attributes
feat(pytypes)!: TxResp for easily handling transaction responses - refactor: move types to pytypes. export all types from nibiru.ptypes module.
fix: Find a gas config that works better for the E2E tests.
test: use ueth instead of unibi for pricefeed_test.
dependencies: Bump package dev version
Pro-tip - Favor BaseException
It's better to use BaseException than Exception if you're looking for a generic error message type because there are several built-in errors that don't count as Exception, but everything counts as BaseException.
Summary
pytest-order
to control the order of tests and break them into more manageable chunksis_insecure
propertysdk_val
orsdk_oracle
oversdk_agent
so that less transfers are required.tests.raises
function that has better UX thanpytest.raises
. See perp_test.py or dex_test.py for some examples.Tests on the
dex
andperp
module are more forgiving in that they don't depend as much on the initial state.dex
tests will fail, and the error messages will be super informative for debugging.Other notable changes
Pro-tip - Favor
BaseException
It's better to use
BaseException
thanException
if you're looking for a generic error message type because there are several built-in errors that don't count asException
, but everything counts asBaseException
.