Hey is there anyway to mock the NamedTuple output of a task and have that output then used in a seperate task?
I have a situation where I have a task with some output
However anytime I try to mock this out with something like
Copy code
class TestNamedTuple(TestCase):
def test_run_workflow(self):
with task_mock(generate) as fake_generate:
fake_generate.return_value = GenerateOutputs(uri="test_uri")
uri = my_wf()
self.assertIsNotNone(uri)
I get an error like :
AttributeError: 'Promise' object has no attribute 'uri'
How do I properly mock a task that has a namedTuple output with only one attribute?
f
freezing-airport-6809
08/16/2022, 3:13 PM
Interesting usecase, I think this might need a change to support easily. Can you file a bug. A solution would be to mock it like the underlying promise object
b
bored-laptop-29637
08/16/2022, 3:18 PM
Yeah absolutely. To be clear if it was a named tuple of say 2 attributes we could just unpack it and there would be no issue?