https://dagster.io/ logo
#ask-community
Title
# ask-community
z

zafar mahmood

09/17/2021, 1:27 PM
Hi , i need a bit of guidance. I am testing solids (pytest) with context. now the solid takes the context and with arguments. Now during testing i get an error ' dagster.core.errors.DagsterInvalidInvocationError: Compute function of solid 'solid_function' has context argument, but no context was provided when invoking. ' an example which is exactly as referenced in documentation
Copy code
@solid( required_resource_keys = {'foo_str' , 'bar_int'})
def solid_function (context, some_json):
       var1 = context.resources.foo_str
       var2 = context.resources.bar_int
### now test 
def test_solid_function ():
    ### too build the context 
    from dagster import build_solid_context
    context = build_solid_context(resources={"foo_str":"some string ... ", 
                                             "bar_int": 344335 
     })
    solid_function(context=context , some_json= '{"name":"John", "age":30, "car":null}' )
can anyone share what i am doing wrong ? and getting the error ' DagsterInvalidInvocationError' Compute function of solid 'solid_function' has context argument, but no context was provided when invoking.
c

chris

09/17/2021, 1:55 PM
Hey! Looks like this is a bug with how kwargs are being processed. To unblock you, calling like so
solid_function(context, some_json='{"name":"John", "age":30, "car":null}')
works
A fix will go in for next release. Thanks for surfacing !
z

zafar mahmood

09/17/2021, 2:12 PM
ya it worked thanks man, but also nice to get a quick support
blob cowboy 1
6 Views