I’ve found that testing is generally pretty great ...
# dagster-feedback
s
I’ve found that testing is generally pretty great in Dagster. Testing ops, jobs, and assets all works really well. Using the new
<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.
Here’s my job:
Copy code
def my_job():
    asset_val = upstream_asset.to_source_asset()
    op1_result = op1()
    op2_result = op2(asset_val, op1_result)
    op3(op2_result)
I might try to do something like
Copy code
def 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?
Maybe I could
materialize_in_memory
my asset, but my
upstream_asset
is pretty complicated here
s
❤️ 1