Spencer Nelson
03/02/2023, 6:12 PM<http://asset.to|asset.to>_source_asset()
in jobs doesn’t have a great story for testing yet though. I think what I’d like is a testing utility that’s something like “Pretend that my_cool_asset was materialized with this_particular_value”, maybe a context manager for that.Spencer Nelson
03/02/2023, 6:13 PMdef my_job():
asset_val = upstream_asset.to_source_asset()
op1_result = op1()
op2_result = op2(asset_val, op1_result)
op3(op2_result)
Spencer Nelson
03/02/2023, 6:14 PMdef test_my_job():
with unittest.mock.patch("path.to.upstream_asset.to_source_asset") as mock_to_source_asset:
mock_to_source_asset.return_val = "foo"
...
my_job.execute_in_process()
but I’m not sure this will work?Spencer Nelson
03/02/2023, 6:16 PMmaterialize_in_memory
my asset, but my upstream_asset
is pretty complicated heresandy
03/03/2023, 10:38 PM