Skip to content
Closed
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
56 changes: 56 additions & 0 deletions .github/workflows/pr-check-naming-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'Test Naming Check'

on:
pull_request:
paths:
- "tests/**"
- ".github/workflows/pr-check-naming-test.yml"

permissions:
contents: read

jobs:
test-name-check:
name: Validate Test File Naming
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@8ade135a368bb9860e15bcafd2cf940ba6f36c4c


- name: Check Unit Test Naming (must start with test_*.py)
run: |
echo "Checking unit tests naming…"

invalid_unit=$(find tests/unit -type f -name "*.py" \
! -name "test_*.py" \
! -name "__init__.py" \
! -name "conftest.py" \
! -name "mock_server.py" \
! -name "utils_for_test.py" \
|| true)

if [ -n "$invalid_unit" ]; then
echo "❌ Invalid Unit Test Filenames:"
echo "$invalid_unit"
exit 1
fi
echo "✔️ Unit test names are valid."

- name: Check Integration Test Naming (must end with _test.py)
run: |
echo "Checking integration test naming…"

invalid_integration=$(find tests/integration -type f -name "*.py" \
! -name "*_test.py" \
! -name "__init__.py" \
! -name "utils_for_test.py" \
|| true)

if [ -n "$invalid_integration" ]; then
echo "❌ Invalid Integration Test Filenames:"
echo "$invalid_integration"
exit 1
fi
echo "✔️ Integration test names are valid."
29 changes: 29 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,32 @@ jobs:
echo "FAIL: No line-level changes detected in CHANGELOG.md."
exit 1
fi

test-name-check:
name: Test File Naming Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@v4

- name: Validate test file naming convention
run: |
echo "Checking for test files that don't end with _test.py..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only the integration tests end with test
the unit tests start with test

invalid_tests=$(find tests -type f -name "*.py" ! -name "*_test.py" || true)

if [ -n "$invalid_tests" ]; then
echo "The following test files don't follow the naming convention (*_test.py):"
echo "$invalid_tests"
echo ""
echo "Please rename them to end with *_test.py so CI can detect and run them."
exit 1
else
echo "All test files follow *_test.py naming convention."
fi
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
## [Unreleased]

### Added
- Added CI check in `.github/workflows/pr-checks.yml` to ensure all test files follow the naming convention `*_test.py`.This prevents untracked or skipped tests from being missed during CI runs.
- Add `TokenFeeScheduleUpdateTransaction` class to support updating custom fee schedules on tokens (#471).
- Add `examples/token_update_fee_schedule_fungible.py` and `examples/token_update_fee_schedule_nft.py` demonstrating the use of `TokenFeeScheduleUpdateTransaction`.
- Update `docs/sdk_users/running_examples.md` to include `TokenFeeScheduleUpdateTransaction`.
Expand Down
14 changes: 14 additions & 0 deletions tests/integration/account_balance_query_e2e.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest

from hiero_sdk_python.query.account_balance_query import CryptoGetAccountBalanceQuery
from tests.integration.utils_for_test import IntegrationTestEnv


@pytest.mark.integration
def test_integration_account_balance_query_can_execute():
env = IntegrationTestEnv()

try:
CryptoGetAccountBalanceQuery(account_id=env.operator_id).execute(env.client)
finally:
env.close()
1 change: 1 addition & 0 deletions unit/failing_test_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def dummy_test(): pass