quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Robbins" <je...@livedata.com>
Subject Re: mod_python 3.3.0-dev-20061109 tests on Win32
Date Mon, 13 Nov 2006 00:47:37 GMT
Graham,


The edit you suggested for the PythonImport test:

assert(map(os.path.normpath, sys.path).count(directory) == 1

works on my Win32 build.

Presumably that change would work on Linux too, yes?

Wanted to let you know.

Thanks,

Jef

----- Original Message ----- 
From: "Graham Dumpleton" <grahamd@dscpl.com.au>
To: "Jeff Robbins" <jeffr@livedata.com>
Cc: "python-dev list" <python-dev@httpd.apache.org>
Sent: Saturday, November 11, 2006 22:11
Subject: Re: mod_python 3.3.0-dev-20061109 tests on Win32


> 
> On 12/11/2006, at 12:18 PM, Graham Dumpleton wrote:
>>> 2) In the 'Testing PythonImport' test, the path separators in the  
>>> two paths being compared are different (no doubt due to Win32  
>>> backslash vs forward slash issues)
>>>
>>> the tests.py code does this:
>>>    directory = os.path.dirname(__file__)
>>>    assert(sys.path.count(directory) == 1)
>>>
>>> os.path.dirname(__file__) is 'C:\\work\\mod_python-3.3.0- 
>>> dev-20061109\\test\\htdocs'
>>>
>>> yet sys.path has this in it 'C:/work/mod_python-3.3.0-dev-20061109/ 
>>> test\\\\htdocs'
>>>
>>> so the assert fails since the first string can't be found in  
>>> sys.path (count == 0)
>>
>> If in test/test.py you change:
>>
>>         c = Container(PythonPath("[r'%s']+sys.path" % DOCUMENT_ROOT),
>>
>> to:
>>
>>         c = Container(PythonPath("[r'%s']+sys.path" %  
>> os.path.normpath(DOCUMENT_ROOT)),
>>
>> does it pass?
> 
> On second thought, possibly better to use:
> 
>   assert(map(os.path.normpath, sys.path).count(directory) == 1)
> 
> in the htdocs/tests.py file instead as it would be more robust.
> 
> Graham
>

Mime
View raw message