So, I'm trying to decide how to plan and organize a test suite for my python project, but I doubt when the unit test is no longer a unit test, and I would like to get some feedback from the community.
If I understand correctly:
- A Unit test check the smallest part of your code, be it a function / method that does one and only one simple thing, even if it has several use cases.
- The Integration test verifies that two or more units of code are executed in the same context, environment, etc. (but try to keep it at the minimum number of units per integration test), work well together and not only on their own.
I doubt that I have a simple function that executes an HTTP request and returns the contents of such a request, be it HTML, JSON, etc., it does not matter, the fact is that the function is very, very simple, but it requests information from an external source, for example:
import requests
def my_function(arg):
return requests.get('http://www.google.com/' + arg).content
Now this is a very stupid example, but I doubt it:
Given that this function requests information from an external source when you write a test for it, can you still read such a Unit test ?
. my_function() , /db/filesystem/etc, . , , , .
!:)
P.S.: , , 100% Unit Integration, , , , , , .