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" <[EMAIL PROTECTED]>
To: "Jeff Robbins" <[EMAIL PROTECTED]>
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

Reply via email to