[Patches] [ python-Patches-1709112 ] test_1686475 of test_os & pagefile.sys

SourceForge.net noreply at sourceforge.net
Mon Apr 30 03:52:32 CEST 2007


Patches item #1709112, was opened at 2007-04-28 06:35
Message generated for change (Comment added) made by abkhd
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1709112&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tests
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: A.B., Khalid (abkhd)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_1686475 of test_os & pagefile.sys 

Initial Comment:
test_1686475 of test_os appears to rely on the
existence of "pagefile.sys" on the C drive like so:

def test_1686475(self):
    # Verify that an open file can be stat'ed
    try:
        os.stat(r"c:\pagefile.sys")
    except WindowsError, e:
        if e == 2: # file does not exist; cannot run test
            return
        self.fail("Could not stat pagefile.sys")


But since pagefile.sys may not be on every C
drive and since the exception object e is not a numeric then that test is probably going to fail if the pagefile.sys does not exist where it is expected.

In such a case Windows returns "[Error 5] Access is denied: 'c:\\pagefile.sys'". So we need to test if e.winerror == 5 to skip this and return without failing.

Patch "test_os.patch" is attached. 

By the way, I see the same problem in the trunk, so maybe this need to be applied there as well.

----------------------------------------------------------------------

>Comment By: A.B., Khalid (abkhd)
Date: 2007-04-30 01:52

Message:
Logged In: YES 
user_id=1079026
Originator: YES

Please see http://www.python.org/sf/1686475 for reference.


Martin,

I think you should be checking for ERROR_ACCESS_DENIED not
ERROR_SHARING_VIOLATION as you do in your patch to r54685 and r54686. The
attached posixmodule patch fixes this issue for me on MinGW. Can you try it
out?
File Added: test_1686475.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1709112&group_id=5470


More information about the Patches mailing list