I’m unit testing a URL fetcher, and I need a test url which always causes urllib2.urlopen() (Python) to time out. I’ve tried making a php page with just sleep(10000) in it, but that causes 500 internal server error.
How would I make a resource that causes a connection timeout in the client whenever it is requested?
While there have been some good answers here, I found that a simple php sleep() call with an override to Apache’s timeout was all I needed.
I know that unit tests should be in isolation, but the server this endpoint is hosted on is no going anywhere.