From 7bfceedc3fa4977a05c8f09cb9b631029b351750 Mon Sep 17 00:00:00 2001 From: aitbc1 Date: Fri, 27 Mar 2026 20:49:23 +0100 Subject: [PATCH] fix: resolve f-string escaping issues in Python debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit F-STRING ESCAPING FIX: Use string concatenation instead of f-strings Issue: - SyntaxError: unterminated f-string literal - f-string escaping conflicts in exec() within YAML - Complex nested quoting causing parsing errors Solution: - Replace f-strings with string concatenation - Use str(e) instead of f"{e}" - Simpler string handling in exec() blocks - Maintain error reporting functionality Changes: - print("❌ src import failed: " + str(e)) - print("❌ aitbc import failed: " + str(e)) - Removes f-string complexity - Preserves error message display Expected results: - No more SyntaxError with f-strings - Import debugging should work - Clear error messages for failed imports - Workflow should proceed to pytest execution This should resolve the f-string escaping conflicts and allow the import debugging to complete successfully. --- .gitea/workflows/python-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/python-tests.yml b/.gitea/workflows/python-tests.yml index 263a9a92..b3687bbc 100644 --- a/.gitea/workflows/python-tests.yml +++ b/.gitea/workflows/python-tests.yml @@ -128,8 +128,8 @@ jobs: # Test specific imports that are failing echo "Testing problematic imports..." - venv/bin/python -c "import sys; print('Testing src import...'); sys.path.insert(0, '/opt/gitea-runner/workspace/repo/apps/agent-protocols/src'); exec('try:\n import message_protocol\n print(\"✅ src.message_protocol import successful\")\nexcept Exception as e:\n print(f\"❌ src import failed: {e}\n')" - venv/bin/python -c "import sys; print('Testing aitbc import...'); sys.path.insert(0, '/opt/gitea-runner/workspace/repo/apps/blockchain-node/src'); exec('try:\n import aitbc_chain\n print(\"✅ aitbc_chain import successful\")\nexcept Exception as e:\n print(f\"❌ aitbc import failed: {e}\n')" + venv/bin/python -c "import sys; print('Testing src import...'); sys.path.insert(0, '/opt/gitea-runner/workspace/repo/apps/agent-protocols/src'); exec('try:\n import message_protocol\n print(\"✅ src.message_protocol import successful\")\nexcept Exception as e:\n print(\"❌ src import failed: \" + str(e))')" + venv/bin/python -c "import sys; print('Testing aitbc import...'); sys.path.insert(0, '/opt/gitea-runner/workspace/repo/apps/blockchain-node/src'); exec('try:\n import aitbc_chain\n print(\"✅ aitbc_chain import successful\")\nexcept Exception as e:\n print(\"❌ aitbc import failed: \" + str(e))')" echo "=== RUNNING PYTHON TESTS ===" echo "Attempting to run tests with comprehensive error handling..."