Hi all -- In unit tests, is there an example for m...
# ask-community
j
Hi all -- In unit tests, is there an example for mocking partitions that use resources? More details in 🧵
Untitled.py
Here is my pseudocode example. It seems like
create_partitions()
is called upon the file instantiation, so it's not possible to mock the partition or the underlying external resource. Thoughts?
s
Hi Juan - that’s accurate. Building a PartitionsDefinition using resources isn’t a typical Dagster pattern. If you want to be able to mock this out, you’d need to create a function that returns your PartitionsDefinition and asset. Or you could use mock.patch.