Azure / Azure/azure-sdk-for-python
Document testing recommendations (and maybe distribute testing utilities)
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
Maybe I'm just missing something, but I've been unable to find solid recommendations on how to mock the Azure SDK for testing. Ideally this would come in the form of a package that developers could use (e.g. `moto`), but at the very least there should be solid documentation on how to do it yourself. I managed to dig up [this issue](https://github.com/Azure/azure-sdk-for-python/issues/14294) but I've been unable to find the docs the closed issue would suggest got created.
Ultimately, I think the maintainers of the Python SDK should strive to distribute utilities that make mocking easier. In their absence people are likely duplicating efforts recreating the same mocks over and over across various projects. Possibly with subtle inaccuracies that end up causing bugs in production that marginally reduce developer satisfaction with Azure.
For my own work I suppose I'll have to resort to patching things manually with `unittest.mock`. That said, I'm not particular satisfied with this as a long-term solution for the reasons mentioned above - first, there's no way I'm the first person to have a need to mock out the blob storage APIs, and second, I'm worried I'll do so incorrectly. For example, what exception does the client raise when I request a blob that doesn't exist? Should I really have to look through the source code to figure that out? With `moto` I can just apply its patches and try it to find out.
Contributor guide
Assessment
This issue has not been assessed yet.