bitter-ability-32190
12/29/2022, 9:35 PME RuntimeError: cannot reuse already awaited coroutine mean in a run_rule_with_mocks test?
This is the only call to run_rule_with_mocks in this testbitter-ability-32190
12/29/2022, 9:46 PMcurved-television-6568
12/29/2022, 10:36 PMbitter-ability-32190
12/29/2022, 10:37 PMcurved-television-6568
12/29/2022, 10:41 PMcurved-television-6568
12/29/2022, 10:44 PMcurved-television-6568
12/29/2022, 10:45 PMcurved-television-6568
12/29/2022, 10:48 PMcurved-television-6568
12/29/2022, 10:49 PMcurved-television-6568
12/29/2022, 10:50 PMcurved-television-6568
12/29/2022, 10:58 PMStopIteration thrown from your rule when it’s done.bitter-ability-32190
12/29/2022, 11:01 PMcurved-television-6568
12/29/2022, 11:01 PMmock_gets=[
MockGet(
output_type=Digest,
input_types=(URLDownloadHandler,),
mock=lambda _: None,
),
and so, the return value from your rule is None, and the mock continuesbitter-ability-32190
12/29/2022, 11:01 PMcurved-television-6568
12/29/2022, 11:02 PMexcept StopIteration as e:
if e.args:
return e.value # type: ignore[no-any-return]curved-television-6568
12/29/2022, 11:03 PMNone, and so doesn’t break the while True of the rule runner..bitter-ability-32190
12/29/2022, 11:03 PMand not or 😂curved-television-6568
12/29/2022, 11:04 PMcurved-television-6568
12/29/2022, 11:05 PMbitter-ability-32190
12/29/2022, 11:05 PMcurved-television-6568
12/29/2022, 11:05 PMraise AssertionError(…)bitter-ability-32190
12/29/2022, 11:05 PMbitter-ability-32190
12/29/2022, 11:06 PMcurved-television-6568
12/29/2022, 11:06 PMbitter-ability-32190
12/29/2022, 11:06 PMcurved-television-6568
12/29/2022, 11:06 PMbitter-ability-32190
12/29/2022, 11:07 PMcurved-television-6568
12/29/2022, 11:07 PMbad = object()
digest = run_rule_with_mocks(
download_file,
rule_args=[
DownloadFile("<http://pantsbuild.com/file.txt>", DOWNLOADS_FILE_DIGEST),
union_membership,
],
mock_gets=[
MockGet(
output_type=Digest,
input_types=(URLDownloadHandler,),
mock=lambda _: bad,
),
MockGet(
output_type=Digest,
input_types=(NativeDownloadFile,),
mock=lambda _: DOWNLOADS_EXPECTED_DIRECTORY_DIGEST,
),
],
union_membership=union_membership,
)
> assert digest == DOWNLOADS_EXPECTED_DIRECTORY_DIGEST
E AssertionError: assert equals failed
E <object object at 0x1065ee870> Digest('4c9cf91fcd7ba1abbf7f9a0a1c8175556a82bee6a398e34db3284525ac24a3ad', 84)
src/python/pants/engine/download_file_integration_test.py:168: AssertionErrorbitter-ability-32190
12/29/2022, 11:08 PMcurved-television-6568
12/29/2022, 11:08 PMbitter-ability-32190
12/30/2022, 2:17 AM