From 9e0da03717e83fab553ade4ca65b1c6cc63b2c81 Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Thu, 10 Sep 2026 09:34:06 -0300 Subject: [PATCH] QTZPOC-20 QTZPOC-20: Refactor test calls by extracting inline arguments into local variables for improved readability. --- tests/laborious/utils/bundle/test_reader.py | 3 ++- tests/laborious/workflows/test_import_model.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/laborious/utils/bundle/test_reader.py b/tests/laborious/utils/bundle/test_reader.py index 5db00ec..73d05b8 100644 --- a/tests/laborious/utils/bundle/test_reader.py +++ b/tests/laborious/utils/bundle/test_reader.py @@ -486,10 +486,11 @@ def test_extract_member_rejects_a_stream_larger_than_its_declared_size( monkeypatch.setattr(zipfile.ZipExtFile, 'read', _oversized_read) + resolved_root = root.resolve() with zipfile.ZipFile(io.BytesIO(buffer.getvalue())) as archive: entry = archive.infolist()[0] with pytest.raises(BundleGateError, match='more than its declared') as error: - reader._extract_member(archive, entry, root, root.resolve()) + reader._extract_member(archive, entry, root, resolved_root) assert error.value.gate == 5 diff --git a/tests/laborious/workflows/test_import_model.py b/tests/laborious/workflows/test_import_model.py index 1bc0266..a93864e 100644 --- a/tests/laborious/workflows/test_import_model.py +++ b/tests/laborious/workflows/test_import_model.py @@ -773,10 +773,11 @@ async def test_a_cancelled_terminal_write_propagates_instead_of_being_reported( @mark.asyncio async def test_a_cancelled_pipeline_failure_report_propagates(import_workflow: ImportModel): patcher = cancelling_activities() + error = RuntimeError('boom') try: with raises(asyncio.CancelledError): await import_workflow._report_failure( - BASE, RuntimeError('boom'), step=ImportStep.REGISTRATION.value, gate=None + BASE, error, step=ImportStep.REGISTRATION.value, gate=None ) finally: patcher.stop() @@ -785,9 +786,10 @@ async def test_a_cancelled_pipeline_failure_report_propagates(import_workflow: I @mark.asyncio async def test_a_cancelled_status_write_failure_report_propagates(import_workflow: ImportModel): patcher = cancelling_activities() + error = RuntimeError('db down') try: with raises(asyncio.CancelledError): - await import_workflow._report_status_write_failure(BASE, RuntimeError('db down')) + await import_workflow._report_status_write_failure(BASE, error) finally: patcher.stop() @@ -795,9 +797,10 @@ async def test_a_cancelled_status_write_failure_report_propagates(import_workflo @mark.asyncio async def test_a_cancelled_retention_check_propagates(import_workflow: ImportModel): patcher = cancelling_activities() + input_data = valid_input() try: with raises(asyncio.CancelledError): - await import_workflow._ensure_retention(BASE, valid_input()) + await import_workflow._ensure_retention(BASE, input_data) finally: patcher.stop()