Skip to content

Commit

Permalink
chore: improve ci info and finalization testing
Browse files Browse the repository at this point in the history
  • Loading branch information
darwintree committed Dec 13, 2024
1 parent 965aa85 commit b70a536
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/local-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
pip install ".[tester]"
- name: Run test
run: |
pytest tests -n 3 --dist loadgroup
pytest tests -vv -n 3 --dist loadgroup
2 changes: 1 addition & 1 deletion .github/workflows/testnet-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
export ENS_ACCOUNT_NAME=${{secrets.ENS_ACCOUNT_NAME}} &&
export ENS_ACCOUNT_SECRET=${{secrets.ENS_ACCOUNT_SECRET}} &&
export TEST_FINALIZATION=1 &&
pytest tests -n 3 --dist loadgroup
pytest tests -vv -n 3 --dist loadgroup
56 changes: 28 additions & 28 deletions tests/middleware/test_pending.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@
if TYPE_CHECKING:
from conflux_web3 import Web3

# @pytest.mark.xdist_group(name="account")
# def test_pending(w3: "Web3", account: LocalAccount, use_testnet: bool):
# # activate by default
# # w3.middleware_onion.add(PendingTransactionMiddleware)
@pytest.mark.xdist_group(name="pending")
def test_pending(w3: "Web3", account: LocalAccount, use_testnet: bool):
# activate by default
# w3.middleware_onion.add(PendingTransactionMiddleware)

# status = w3.cfx.get_status()
# addr = account.address
status = w3.cfx.get_status()
addr = account.address

# tx = {
# 'from': addr,
# 'nonce': w3.cfx.get_next_nonce(addr),
# 'gas': 21000,
# 'to': w3.cfx.account.create().address,
# 'value': 100,
# 'maxFeePerGas': 2 * w3.cfx.gas_price,
# 'maxPriorityFeePerGas': 0,
# 'chainId': w3.cfx.chain_id,
# 'storageLimit': 0,
# 'epochHeight': status['epochNumber']
# }
# signed = account.sign_transaction(tx)
# rawTx = signed.raw_transaction
# pending = w3.cfx.send_raw_transaction(rawTx)
# # hash = cast(PendingTransaction, hash)
# pending.mined()
# pending.executed()
# pending.confirmed()
# if use_testnet and os.environ.get("TEST_FINALIZATION", None):
# with pytest.warns(UserWarning):
# pending.finalized()
tx = {
'from': addr,
'nonce': w3.cfx.get_next_nonce(addr),
'gas': 21000,
'to': w3.cfx.account.create().address,
'value': 100,
'maxFeePerGas': 2 * w3.cfx.gas_price,
'maxPriorityFeePerGas': 0,
'chainId': w3.cfx.chain_id,
'storageLimit': 0,
'epochHeight': status['epochNumber']
}
signed = account.sign_transaction(tx)
rawTx = signed.raw_transaction
pending = w3.cfx.send_raw_transaction(rawTx)
# hash = cast(PendingTransaction, hash)
pending.mined()
pending.executed()
pending.confirmed()
if use_testnet and os.environ.get("TEST_FINALIZATION", None):
with pytest.warns(UserWarning):
pending.finalized()

0 comments on commit b70a536

Please sign in to comment.