prefect
prefect copied to clipboard
`invoke_and_assert` utility asserts on truncated output.
First check
- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.
Bug summary
When using the invoke_and_assert
utility for testing the command line the content that's asserted against is a truncated version.
Reproduction
import pytest
from prefect import flow
from prefect.orion.schemas import states
from prefect.testing.cli import invoke_and_assert
@flow(name="hello")
def hello_flow():
return "Hello!"
@pytest.fixture
async def scheduled_flow_run(orion_client):
return await orion_client.create_flow_run(
name="scheduled_flow_run", flow=hello_flow, state=states.Scheduled()
)
def test_my_great_test(scheduled_flow_run):
invoke_and_assert(
command=["flow-run", "ls"],
expected_output_contains=str(scheduled_flow_run.id),
expected_code=0,
)
Error
------ CLI output ------
Flow Runs
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━┓
┃ ID ┃ … ┃ Name ┃ State ┃ When ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━┩
│ 46eadfd7-c9ea-4b7a-8342-26a10ed… │ … │ scheduled_flo… │ SCHE… │ a few secon… │
└──────────────────────────────────┴───┴────────────────┴───────┴──────────────┘
------ desired content ------
46eadfd7-c9ea-4b7a-8342-26a10ed65eca
Versions
Clean checkout of main
.
Additional context
No response