Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/python: Fix test and lint to ci #1401

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/bindings-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ jobs:
working-directory: bindings/python
run: tox -e lint-examples

- name: Run linter for tests
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ startsWith(matrix.os, 'ubuntu-latest') }}
working-directory: bindings/python
run: tox -e lint-tests

- name: Run tests
working-directory: bindings/python
run: tox
File renamed without changes.
2 changes: 1 addition & 1 deletion bindings/python/tests/address_generation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Copyright 2023 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0

from iota_sdk import Wallet, MnemonicSecretManager, CoinType, ClientOptions
import shutil
from iota_sdk import Wallet, MnemonicSecretManager, CoinType, ClientOptions


def test_address_generation_iota():
Expand Down
13 changes: 6 additions & 7 deletions bindings/python/tests/test_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
# Copyright 2023 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0

from iota_sdk import Block, Client, MnemonicSecretManager, Utils, SecretManager, OutputId, hex_to_utf8, utf8_to_hex, Bip44, CoinType, Irc27Metadata, Irc30Metadata
import json
import unittest
from iota_sdk import Block, Client, MnemonicSecretManager, Utils, SecretManager, OutputId, hex_to_utf8, utf8_to_hex, Bip44, CoinType, Irc27Metadata, Irc30Metadata


# Read the test vector
tv = dict()
with open('../../sdk/tests/client/fixtures/test_vectors.json') as json_file:
tv = {}
with open('../../sdk/tests/client/fixtures/test_vectors.json', "r", encoding="utf-8") as json_file:
tv = json.load(json_file)

client = Client()
Expand Down Expand Up @@ -57,13 +58,11 @@ def test_output_id(self):
transaction_id = '0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649'
output_index = 42
output_id = OutputId(transaction_id, output_index)
assert output_id.__repr__(
) == '0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c6492a00'
assert repr(output_id) == '0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c6492a00'

new_output_id = OutputId.from_string(
'0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c6492a00')
assert new_output_id.__repr__(
) == '0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c6492a00'
assert repr(new_output_id) == '0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c6492a00'
assert new_output_id.transaction_id == transaction_id
assert new_output_id.output_index == output_index

Expand Down
2 changes: 1 addition & 1 deletion bindings/python/tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Copyright 2023 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0

from iota_sdk import BasicOutput, AliasOutput, FoundryOutput, NftOutput, IssuerFeature, MetadataFeature
from dacite import from_dict
from iota_sdk import BasicOutput, AliasOutput, FoundryOutput, NftOutput, IssuerFeature, MetadataFeature


def test_feature():
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/tests/test_wallet_destroy.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2023 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0

from iota_sdk import Wallet, MnemonicSecretManager, CoinType, ClientOptions, WalletError
import shutil
import unittest
from iota_sdk import Wallet, MnemonicSecretManager, CoinType, ClientOptions, WalletError


class WalletDestroy(unittest.TestCase):
Expand Down
11 changes: 10 additions & 1 deletion bindings/python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,13 @@ deps =
pylint
commands =
pip install .
pylint --rcfile=examples/.pylintrc examples/**/*.py
pylint --rcfile=.pylintrc examples/**/*.py

[testenv:lint-tests]
description = Run pylint {basepython} on tests
deps =
-r requirements-dev.txt
pylint
commands =
pip install .
pylint --disable=missing-function-docstring,missing-class-docstring --rcfile=.pylintrc tests/**/*.py