On 4/28/07, Calvin Spealman <ironfroggy at gmail.com> wrote: > Index: test_os.py > =================================================================== > --- test_os.py (revision 54982) > +++ test_os.py (working copy) > @@ -6,6 +6,7 @@ > import unittest > import warnings > import sys > +import tempfile > from test import test_support > > warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__) > @@ -241,13 +242,18 @@ > self.assertEquals(os.stat(self.fname).st_mtime, t1) > > def test_1686475(self): > + fn = tempfile.mktemp() > + openfile = open(fn, 'w') > # Verify that an open file can be stat'ed > try: > - os.stat(r"c:\pagefile.sys") > + os.stat(fn) > except WindowsError, e: > if e == 2: # file does not exist; cannot run test > return > self.fail("Could not stat pagefile.sys") > + finally: > + openfile.close() > + os.remove(fn) > > from test import mapping_tests mktemp() is deprecated. You may want to use mkstemp(). There will be no need for explicit open as well as mkstemp() also returns open descriptor. Thanks, Raghu.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4