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

Pranav Manjapra

08/28/2023, 11:43 PM
Hey all, I'm trying to write unit tests for an op that requires a
context
. What's the best way to mock the context if the op accesses special context fields like
context.op.name
and
context.job_name
?
build_op_context()
does not set these fields. Before the new python config and configurable resources, I used to pass
MagicMock()
for the context as a workaround but now I get this error when I try to use MagicMock:
Copy code
dagster._core.errors.DagsterInvalidInvocationError: Cannot provide resources in both context and kwargs
Any help would be appreciated, thanks!
s

sandy

08/29/2023, 5:46 PM
Hi Pranav - would you mind filing a Github issue with the code that you'd expect to work but does not?
p

Pranav Manjapra

08/30/2023, 9:27 AM
Hi @sandy, I opened an issue here: https://github.com/dagster-io/dagster/issues/16195 Thanks!
2 Views