I want to ensure that my tests don't use third-party services when they are run.
These answers cover the case when no connections are possible at all.
I want to be able to make TCP connections to the local database (one of the cases).
How to patch Python runtime to allow TCP connections to localhost (or a given host, ideally to the specified ports)?