os.path.setmtime ?
Richard Wesley
hawkfish at trustedmedianetworks.com
Mon Oct 13 15:38:12 EDT 2003
More information about the Python-list mailing list
Mon Oct 13 15:38:12 EDT 2003
- Previous message (by thread): os.path.setmtime ?
- Next message (by thread): IDLE won't start
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <mailman.67.1066071133.2192.python-list at python.org>, Holger Krekel <pyth at devel.trillke.net> wrote: > Richard Wesley wrote: > > I am trying to set the mod date on a file (Linux) as part of a unit test > > run. I can just wait one second, but that slows the test down. A > > better solution would be to tweak the mod date on a file, but os.path > > does not seem to have setmtime. > > > > Is there any simple way to do this? > > it is spelled > > os.utime Thanks, that did the trick. Saves me 2-3 seconds per test. > > in python. > > os.utime(path, None) > > will set a/mtime to current time and > > os.utime (path, (-1, newtime)) > > will set mtime to newtime. Note, however, that the effects and the > actual time resolution of this call are very platform independant. I am making relative changes under Linux, so this is pretty well controlled. -- - rmgw <http://www.trustedmedianetworks.com/> ---------------------------------------------------------------------------- Richard Wesley Trusted Media Networks, Inc. "The professor is teaching me about 'tea'. It's very complicated." - Leela in "Dr. Who: The Talons of Weng-Chiang"
- Previous message (by thread): os.path.setmtime ?
- Next message (by thread): IDLE won't start
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list