4 ms·
How well are your codebases unit tested? I shiver thinking about trying to add good tests to a project in any language without good di/ioc.
by RhodesianHunter 9y ago
How well are your codebases unit tested?
I shiver thinking about trying to add good tests to a project in any language without good di/ioc.
- bramblerose 9y agoThe dynamicness of languages like Python make it relatively easy to do so. For example, it's difficult in Java to mock an http request if you can't inject a `HttpRequestor` (or so) to the object you're testing. In Python, it is common practice to patch objects, which means that even though the code calls `requests.get()`, the call will actually be patched through to a mock. (in the Java world, this is possible with e.g. PowerMock, but generally frowned upon)