-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make sure pyproject.toml has all required dependencies * Add tests * Add github actions to run test suite * Fix CI (#1) --------- Co-authored-by: Peter Volnov <41264338+pvolnov@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
1,524 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
tags: [v*] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.7.1 | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run tests | ||
run: poetry run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
venv | ||
*.pyc | ||
.DS_Store | ||
build | ||
dist | ||
.idea | ||
tests | ||
py_near.egg-info | ||
poetry.lock | ||
env | ||
.env |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
|
||
from py_near.account import Account | ||
from py_near.dapps.fts import FtModel | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
async def rpc_url() -> Account: | ||
return "https://rpc.testnet.near.org" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
async def account(rpc_url) -> Account: | ||
acc = Account( | ||
account_id="py-near.testnet", | ||
rpc_addr=rpc_url, | ||
) | ||
|
||
await acc.startup() | ||
|
||
# quick check that the account started up correctly | ||
assert acc.chain_id == "testnet" | ||
|
||
return acc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
async def test_account_get_balance(account): | ||
assert await account.get_balance() > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
|
||
from py_near.dapps.fts import FtModel | ||
|
||
|
||
@pytest.fixture | ||
async def usdc(): | ||
return FtModel("usdc.orderly-qa.testnet", 6) | ||
|
||
|
||
async def test_ft_balance(account, usdc): | ||
assert await account.ft.get_ft_balance(usdc) == 0 |