Skip to content

Commit

Permalink
test: improve test flow
Browse files Browse the repository at this point in the history
  • Loading branch information
darwintree committed Nov 4, 2024
1 parent 74cb9a3 commit a16fa9b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: coverage

on:
pull_request:
push:
branches: ["v1"]

jobs:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/local-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
pull_request:
branches: [ "dev", "v1"]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install ".[tester]"
- name: Run test
run: |
pytest tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
name: Python package

on:
push:
branches: [ "dev", "v1", "cns"]
pull_request:
branches: [ "dev", "v1"]

jobs:
build:
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.10", "3.11", "3.12", "3.13"] # 3.9 is tested in coverage
python-version: ["3.13"]

steps:
- uses: actions/checkout@v3
Expand All @@ -27,15 +27,10 @@ jobs:
run: |
pip install ".[tester]"
- name: Run test
run: |
pytest tests
- name: Run test on testnet
run: |
export TESTNET_URL=${{secrets.TESTNET_URL}} &&
export USE_TESTNET=1 &&
export ENS_ACCOUNT_NAME=${{secrets.ENS_ACCOUNT_NAME}} &&
export ENS_ACCOUNT_SECRET=${{secrets.ENS_ACCOUNT_SECRET}} &&
export TEST_FINALIZATION=1 &&
pytest tests
- name: test finalization api
run: |
export USE_TESTNET=1 && export TEST_FINALIZATION=1 && pytest tests/middleware/test_pending.py
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
from conflux_web3.types import (
Base32Address
)
from conflux_web3.middleware import (
Wallet
)

dotenv.load_dotenv()

Expand Down
1 change: 0 additions & 1 deletion tests/rpcs/cfx/test_cfx_block_rpcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def no_full_block_data(self, w3:Web3, block_hash: bytes, use_testnet: bool):
def test_get_block_by_hash(self, block_data: BlockData, no_full_block_data: BlockData):
TypeValidator.validate_typed_dict(block_data, "BlockData")
TypeValidator.validate_typed_dict(no_full_block_data, "BlockData")
return block_data

def test_get_block_by_epoch_number(self, w3:Web3, block_data: BlockData, use_testnet: bool):
assert block_data['epochNumber'] is not None
Expand Down

0 comments on commit a16fa9b

Please sign in to comment.