mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-26 18:35:05 +00:00
fix(integration): address review findings in docs and diagnostics
This commit is contained in:
6 files changed
+31
-13
No files matched your search
@@ -10,7 +10,7 @@
|
||||
"id": "hand-seeded",
|
||||
"source": "manual-curation-pending-regeneration"
|
||||
},
|
||||
"registryDigest": "eb958f9f43b73851550a2142dc5c5da693bba33bf1c8267db3d9722cee4b891b",
|
||||
"registryDigest": "1cbe4074364e551b4cc250b18e476b041e4829e95238fabfc1459a9c2fb563da",
|
||||
"schemaVersion": 1,
|
||||
"triggers": {
|
||||
"skill:agent-runtime-gateway-smoke-test": [
|
||||
|
||||
@@ -486,20 +486,21 @@ async def test_async_with_fixture(async_client):
|
||||
|
||||
### Async Fixture (FastAPI)
|
||||
|
||||
`ASGITransport` does not run lifespan events. If the app needs startup/shutdown, wrap the client block in `async with LifespanManager(app) as manager:` (from `asgi_lifespan`)
|
||||
and use `ASGITransport(app=manager.app)`. See [FastAPI's async testing guidance](https://github.com/fastapi/fastapi/blob/master/docs/en/docs/advanced/async-tests.md).
|
||||
`ASGITransport` does not run lifespan events. Install `asgi-lifespan` and wrap the client in `LifespanManager` when the app uses startup or shutdown handlers. See [FastAPI's async testing guidance](https://github.com/fastapi/fastapi/blob/master/docs/en/docs/advanced/async-tests.md).
|
||||
|
||||
```python
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from asgi_lifespan import LifespanManager
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def async_client():
|
||||
"""Async fixture providing async test client."""
|
||||
"""Async fixture providing async test client with lifespan events."""
|
||||
app = create_app() # Returns a FastAPI application
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
||||
yield client
|
||||
async with LifespanManager(app) as manager:
|
||||
async with AsyncClient(transport=ASGITransport(app=manager.app), base_url="http://test") as client:
|
||||
yield client
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_api_endpoint(async_client):
|
||||
|
||||
@@ -25,8 +25,9 @@ function normalizeFailureReason(reason) {
|
||||
// A closing quote must be followed by a delimiter, not another name character.
|
||||
.replace(/(["'])(?:[a-z]:[\\/]|\\\\)[^\r\n]*?\1(?=[:\s),;.!?]|$)/gu, '$1<path>$1')
|
||||
// Directories may contain spaces, but trailing whitespace separates diagnostic prose.
|
||||
// Spaced leaves need an extension before a colon, or quotes; preserve extensionless diagnostics.
|
||||
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: [^\\/:*?"<>|\r\n]*\.[^\s\\/:*?"<>|]+(?=:))?[\\/]*/gu, '<path>')
|
||||
// Unquoted spaced leaves allow one final dotted token; longer prose stays diagnostic.
|
||||
// Quote paths with multiple spaces in the final filename to remove ambiguity.
|
||||
.replace(/(?:\b[a-z]:|\\)[\\/](?:[^\\/:*?"<>|\r\n]*[^\s\\/:*?"<>|][\\/])*[^\s\\/:*?"<>|(),;]+(?: (?!failed\b|timed\b|could\b|cannot\b|unable\b|error\b)[^\s\\/:*?"<>|]+\.[^\s\\/:*?"<>|]+(?=:))?[\\/]*/gu, '<path>')
|
||||
// Strip remaining file paths
|
||||
.replace(/(?:\b[a-z]:)?[\\/][\w./\\-]+/g, '<path>')
|
||||
// Collapse whitespace
|
||||
|
||||
@@ -486,20 +486,21 @@ async def test_async_with_fixture(async_client):
|
||||
|
||||
### Async Fixture (FastAPI)
|
||||
|
||||
`ASGITransport` does not run lifespan events. If the app needs startup/shutdown, wrap the client block in `async with LifespanManager(app) as manager:` (from `asgi_lifespan`)
|
||||
and use `ASGITransport(app=manager.app)`. See [FastAPI's async testing guidance](https://github.com/fastapi/fastapi/blob/master/docs/en/docs/advanced/async-tests.md).
|
||||
`ASGITransport` does not run lifespan events. Install `asgi-lifespan` and wrap the client in `LifespanManager` when the app uses startup or shutdown handlers. See [FastAPI's async testing guidance](https://github.com/fastapi/fastapi/blob/master/docs/en/docs/advanced/async-tests.md).
|
||||
|
||||
```python
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from asgi_lifespan import LifespanManager
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
async def async_client():
|
||||
"""Async fixture providing async test client."""
|
||||
"""Async fixture providing async test client with lifespan events."""
|
||||
app = create_app() # Returns a FastAPI application
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
||||
yield client
|
||||
async with LifespanManager(app) as manager:
|
||||
async with AsyncClient(transport=ASGITransport(app=manager.app), base_url="http://test") as client:
|
||||
yield client
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_api_endpoint(async_client):
|
||||
|
||||
@@ -15,6 +15,8 @@ const commands = [
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
console.log('Skipped: Santa Loop examples require Bash');
|
||||
console.log('Passed: 0');
|
||||
console.log('Failed: 0');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +172,19 @@ async function runTests() {
|
||||
assert.strictEqual(groupFailures(runs).size, 3);
|
||||
})) passed += 1; else failed += 1;
|
||||
|
||||
if (await test('keeps dotted diagnostic prose after extensionless Windows paths separate', async () => {
|
||||
const reasons = [
|
||||
String.raw`Command C:\tools\node failed to open config.json: EACCES`,
|
||||
String.raw`Command D:\tools\node timed out opening config.json: EACCES`,
|
||||
];
|
||||
assert.deepStrictEqual(reasons.map(normalizeFailureReason), [
|
||||
'command <path> failed to open config.json: eacces',
|
||||
'command <path> timed out opening config.json: eacces',
|
||||
]);
|
||||
const runs = reasons.map((failureReason, index) => makeSkillRun({ id: `dotted-${index}`, failureReason }));
|
||||
assert.strictEqual(groupFailures(runs).size, 2);
|
||||
})) passed += 1; else failed += 1;
|
||||
|
||||
if (await test('groupFailures handles mixed outcome casing', async () => {
|
||||
const runs = [
|
||||
makeSkillRun({ id: 'r1', outcome: 'FAILURE', failureReason: 'timeout' }),
|
||||
|
||||
Reference in new issue
Block a user