Skip to content

Commit 2dc761d

Browse files
chore: rename all test files for consistency (#1055) (#1093)
Signed-off-by: Osman Kaplan <[email protected]>
1 parent 9289d60 commit 2dc761d

File tree

179 files changed

+119
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+119
-115
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
5555
`test.yml``pr-check-test.yml` (#1043)
5656
- Cleaned up `token_airdrop_claim_auto` example for pylint compliance (no functional changes). (#1079)
5757
- Update team notification script and workflow for P0 issues 'p0_issues_notify_team.js'
58-
58+
- Rename test files across the repository to ensure they consistently end with _test.py (#1055)
5959

6060
### Fixed
6161

docs/sdk_developers/testing.md

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -110,29 +110,30 @@ from hiero_sdk_python.account.account_create_transaction import AccountCreateTra
110110
from hiero_sdk_python.crypto.private_key import PrivateKey
111111
from hiero_sdk_python.hbar import Hbar
112112
from hiero_sdk_python.response_code import ResponseCode
113-
from tests.integration.utils_for_test import IntegrationTestEnv
113+
from tests.integration.utils import IntegrationTestEnv
114+
114115

115116
@pytest.mark.integration
116117
def test_integration_account_create_transaction_can_execute():
117-
"""Test that an account can be created on the network."""
118-
env = IntegrationTestEnv()
119-
try:
120-
new_account_private_key = PrivateKey.generate()
121-
new_account_public_key = new_account_private_key.public_key()
122-
initial_balance = Hbar(2)
123-
124-
transaction = AccountCreateTransaction(
125-
key=new_account_public_key,
126-
initial_balance=initial_balance,
127-
memo="Test Account"
128-
)
129-
transaction.freeze_with(env.client)
130-
receipt = transaction.execute(env.client)
131-
132-
assert receipt.account_id is not None, "Account ID should be present"
133-
assert receipt.status == ResponseCode.SUCCESS
134-
finally:
135-
env.close()
118+
"""Test that an account can be created on the network."""
119+
env = IntegrationTestEnv()
120+
try:
121+
new_account_private_key = PrivateKey.generate()
122+
new_account_public_key = new_account_private_key.public_key()
123+
initial_balance = Hbar(2)
124+
125+
transaction = AccountCreateTransaction(
126+
key=new_account_public_key,
127+
initial_balance=initial_balance,
128+
memo="Test Account"
129+
)
130+
transaction.freeze_with(env.client)
131+
receipt = transaction.execute(env.client)
132+
133+
assert receipt.account_id is not None, "Account ID should be present"
134+
assert receipt.status == ResponseCode.SUCCESS
135+
finally:
136+
env.close()
136137
```
137138

138139
### When to Write Integration Tests
@@ -328,13 +329,13 @@ uv run pytest -m integration
328329
#### Run Specific Test File
329330

330331
```bash
331-
uv run pytest tests/unit/test_hbar.py
332+
uv run pytest tests/unit/hbar_test.py
332333
```
333334

334335
#### Run Specific Test Function
335336

336337
```bash
337-
uv run pytest tests/unit/test_hbar.py::test_hbar_conversion_to_tinybars
338+
uv run pytest tests/unit/hbar_test.py::test_hbar_conversion_to_tinybars
338339
```
339340

340341
#### Run Tests with Verbose Output
@@ -457,7 +458,7 @@ You may look at an already-created unit test file for better clarity:
457458

458459
```bash
459460
# Run unit tests
460-
uv run pytest tests/unit/tokens/test_token_transfer.py -v
461+
uv run pytest tests/unit/tokens/token_transfer_test.py -v
461462

462463
# Run integration tests
463464
uv run pytest tests/integration/token_transfer_e2e_test.py -v
@@ -607,15 +608,16 @@ def test_with_fixtures(sample_account_id, sample_token_id):
607608
The `env` fixture from `utils_for_test.py` provides a configured test environment:
608609

609610
```python
610-
from tests.integration.utils_for_test import env
611+
from tests.integration.utils import env
612+
611613

612614
@pytest.mark.integration
613615
def test_with_env_fixture(env):
614-
"""Test using the env fixture."""
615-
# env.client is already configured
616-
# env.operator_id and env.operator_key are available
617-
account = env.create_account() # Helper method
618-
assert account.id is not None
616+
"""Test using the env fixture."""
617+
# env.client is already configured
618+
# env.operator_id and env.operator_key are available
619+
account = env.create_account() # Helper method
620+
assert account.id is not None
619621
```
620622

621623
#### 2. **Always Clean Up Resources**
@@ -720,21 +722,22 @@ The `tests/integration/utils_for_test.py` file provides essential testing utilit
720722
#### IntegrationTestEnv Class
721723

722724
```python
723-
from tests.integration.utils_for_test import IntegrationTestEnv, env
725+
from tests.integration.utils import IntegrationTestEnv, env
724726

725727
# Create environment manually
726728
env = IntegrationTestEnv()
727729
try:
728-
# Use env.client, env.operator_id, env.operator_key
729-
pass
730+
# Use env.client, env.operator_id, env.operator_key
731+
pass
730732
finally:
731-
env.close()
733+
env.close()
734+
732735

733736
# Or use the pytest fixture (recommended)
734737
@pytest.mark.integration
735738
def test_example(env):
736-
# env is automatically created and cleaned up
737-
account = env.create_account()
739+
# env is automatically created and cleaned up
740+
account = env.create_account()
738741
```
739742

740743
**Key Methods:**
@@ -747,25 +750,26 @@ def test_example(env):
747750
#### Helper Functions
748751

749752
```python
750-
from tests.integration.utils_for_test import (
751-
create_fungible_token,
752-
create_nft_token,
753-
env
753+
from tests.integration.utils import (
754+
create_fungible_token,
755+
create_nft_token,
756+
env
754757
)
755758

759+
756760
@pytest.mark.integration
757761
def test_with_helpers(env):
758-
# Create a fungible token with default settings
759-
token_id = create_fungible_token(env)
760-
761-
# Create an NFT token
762-
nft_id = create_nft_token(env)
763-
764-
# Use custom configuration with lambdas
765-
token_id = create_fungible_token(env, [
766-
lambda tx: tx.set_decimals(8),
767-
lambda tx: tx.set_initial_supply(1000000)
768-
])
762+
# Create a fungible token with default settings
763+
token_id = create_fungible_token(env)
764+
765+
# Create an NFT token
766+
nft_id = create_nft_token(env)
767+
768+
# Use custom configuration with lambdas
769+
token_id = create_fungible_token(env, [
770+
lambda tx: tx.set_decimals(8),
771+
lambda tx: tx.set_initial_supply(1000000)
772+
])
769773
```
770774

771775
### Pytest Markers

tests/integration/account_allowance_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from hiero_sdk_python.tokens.token_mint_transaction import TokenMintTransaction
1818
from hiero_sdk_python.transaction.transaction_id import TransactionId
1919
from hiero_sdk_python.transaction.transfer_transaction import TransferTransaction
20-
from tests.integration.utils_for_test import create_fungible_token, create_nft_token, env
20+
from tests.integration.utils import create_fungible_token, create_nft_token, env
2121

2222

2323
def _create_spender_and_receiver_accounts(env):

tests/integration/account_balance_query_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from hiero_sdk_python.query.account_balance_query import CryptoGetAccountBalanceQuery
4-
from tests.integration.utils_for_test import IntegrationTestEnv
4+
from tests.integration.utils import IntegrationTestEnv
55

66

77
@pytest.mark.integration

tests/integration/account_create_transaction_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from hiero_sdk_python.hbar import Hbar
66
from hiero_sdk_python.query.account_info_query import AccountInfoQuery
77
from hiero_sdk_python.response_code import ResponseCode
8-
from tests.integration.utils_for_test import env
8+
from tests.integration.utils import env
99

1010

1111
@pytest.mark.integration

tests/integration/account_delete_transaction_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from hiero_sdk_python.tokens.nft_id import NftId
1515
from hiero_sdk_python.tokens.token_airdrop_transaction import TokenAirdropTransaction
1616
from hiero_sdk_python.tokens.token_mint_transaction import TokenMintTransaction
17-
from tests.integration.utils_for_test import (
17+
from tests.integration.utils import (
1818
create_fungible_token,
1919
create_nft_token,
2020
env,

tests/integration/account_info_query_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from hiero_sdk_python.tokens.token_kyc_status import TokenKycStatus
1616
from hiero_sdk_python.tokens.token_unfreeze_transaction import TokenUnfreezeTransaction
1717
from hiero_sdk_python.tokens.token_mint_transaction import TokenMintTransaction
18-
from tests.integration.utils_for_test import IntegrationTestEnv, create_fungible_token, create_nft_token
18+
from tests.integration.utils import IntegrationTestEnv, create_fungible_token, create_nft_token
1919

2020
@pytest.mark.integration
2121
def test_integration_account_info_query_can_execute():

tests/integration/account_records_query_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from hiero_sdk_python.hbar import Hbar
1111
from hiero_sdk_python.response_code import ResponseCode
1212
from hiero_sdk_python.transaction.transfer_transaction import TransferTransaction
13-
from tests.integration.utils_for_test import env
13+
from tests.integration.utils import env
1414

1515

1616
@pytest.mark.integration

tests/integration/account_update_transaction_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from hiero_sdk_python.query.account_info_query import AccountInfoQuery
1515
from hiero_sdk_python.response_code import ResponseCode
1616
from hiero_sdk_python.timestamp import Timestamp
17-
from tests.integration.utils_for_test import env
17+
from tests.integration.utils import env
1818

1919

2020
@pytest.mark.integration

tests/integration/batch_transaction_e2e_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from hiero_sdk_python.timestamp import Timestamp
1212
from hiero_sdk_python.transaction.batch_transaction import BatchTransaction
1313
from hiero_sdk_python.transaction.transfer_transaction import TransferTransaction
14-
from tests.integration.utils_for_test import env
14+
from tests.integration.utils import env
1515

1616
def create_account_tx(key, client):
1717
"""Helper transaction to create an account."""

0 commit comments

Comments
 (0)