Python Testing with pytest: Chapter 2 testing a package

Reading this chapter several times I’m trying to understand how to properly run test against the code of a package.

It looks to me that we need to install the package with pip before running tests against it. I know we can use the -e flag in pip to make the package editable while developing. But, why not testing directly the code in the src folder instead of the one installed? What about testing code that is internal to the package and not exposed outside the package?(do not know if that is correct in python)

I’m just trying to understand the correct way to test in python.

Thanks