My longest and latest job interview lasted 3 hours but we talked about the goals and the visions of the company (that part doesn't bother me), the technical part (code with a pen + questions) lasted about 15 mins. But to set a threshold, generally i ask if the test requires more than 1 hour, if yes, I decline politely.