Comment

Virgil Dupras

I ran into a need for this just today and I remembered I had read about your post. I thought you might be interested by the approach I took (I feel it's a little more generic and elegant than your solution):

https://hardcoded.svn.beanstalkapp.com/lib/hsutil/trunk/testcase.py

You make your testcases subclass this TestCase, then just call self.mock_osstat('mypath', st_mtime=42)