From 8d82b1d01d1e727ad694e9e818ebc4f3a4a9d1c9 Mon Sep 17 00:00:00 2001 From: aitbc Date: Tue, 5 May 2026 17:16:12 +0200 Subject: [PATCH] fix: add missing imports and enable asyncio_mode for pytest - Add import requests to test_block_import.py, test_minimal.py, test_simple_import.py, test_tx_import.py - Add -o asyncio_mode=auto to pytest command to enable pytest-asyncio - Fixes NameError and async function not supported errors in python-tests.yml --- .gitea/workflows/python-tests.yml | 1 + tests/verification/test_block_import.py | 5 +++-- tests/verification/test_minimal.py | 1 + tests/verification/test_simple_import.py | 1 + tests/verification/test_tx_import.py | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/python-tests.yml b/.gitea/workflows/python-tests.yml index 0ffcf7d4..638ff7f4 100644 --- a/.gitea/workflows/python-tests.yml +++ b/.gitea/workflows/python-tests.yml @@ -81,6 +81,7 @@ jobs: tests/verification/ \ -c /dev/null --rootdir "$PWD" --import-mode=importlib \ --tb=short -q --timeout=30 \ + -o asyncio_mode=auto \ --cov=apps --cov=packages --cov=cli --cov-append - name: Run app and package tests with coverage diff --git a/tests/verification/test_block_import.py b/tests/verification/test_block_import.py index 9d296796..b8e49d28 100644 --- a/tests/verification/test_block_import.py +++ b/tests/verification/test_block_import.py @@ -7,6 +7,7 @@ Tests the /rpc/blocks/import POST endpoint functionality import json import hashlib from datetime import datetime, UTC +import requests # Test configuration BASE_URL = "https://aitbc.bubuit.net/rpc" @@ -24,8 +25,8 @@ def test_block_import(): print("=" * 50) # Get current head to work with existing blockchain - client = AITBCHTTPClient() - head = client.get(f"{BASE_URL}/head") + head_response = requests.get(f"{BASE_URL}/head") + head = head_response.json() print(f"Current head: height={head['height']}, hash={head['hash']}") # Use very high heights to avoid conflicts with existing chain diff --git a/tests/verification/test_minimal.py b/tests/verification/test_minimal.py index 007f09a8..20ff4573 100644 --- a/tests/verification/test_minimal.py +++ b/tests/verification/test_minimal.py @@ -5,6 +5,7 @@ Minimal test to debug transaction import import json import hashlib +import requests from aitbc import AITBCHTTPClient, NetworkError BASE_URL = "https://aitbc.bubuit.net/rpc" diff --git a/tests/verification/test_simple_import.py b/tests/verification/test_simple_import.py index 835e9ecd..84a53396 100644 --- a/tests/verification/test_simple_import.py +++ b/tests/verification/test_simple_import.py @@ -5,6 +5,7 @@ Simple test for block import endpoint without transactions import json import hashlib +import requests from aitbc import AITBCHTTPClient, NetworkError BASE_URL = "https://aitbc.bubuit.net/rpc" diff --git a/tests/verification/test_tx_import.py b/tests/verification/test_tx_import.py index 5c0f5ba9..b0f71c32 100644 --- a/tests/verification/test_tx_import.py +++ b/tests/verification/test_tx_import.py @@ -5,6 +5,7 @@ Test transaction import specifically import json import hashlib +import requests from aitbc import AITBCHTTPClient, NetworkError BASE_URL = "https://aitbc.bubuit.net/rpc"