Re: Change to test_Session_Session_conf() of test/test.py.

2006-02-04 Thread Nicolas Lehuen
2006/2/4, Graham Dumpleton [EMAIL PROTECTED]:
 Jim, Nicolas

 Would it make sense to change test_Session_Session_conf() function in
 unit tests to something like:

  def test_Session_Session_conf(self):

  import tempfile
  tempdir = tempfile.gettempdir()
  database = os.path.join(tempdir,mp_sess_test.dbm)

  c = VirtualHost(*,
  ServerName(test_Session_Session),
  DocumentRoot(DOCUMENT_ROOT),
  Directory(DOCUMENT_ROOT,
PythonOption('session_dbm %s' %
 database),
SetHandler(mod_python),

 PythonHandler(tests::Session_Session),
PythonDebug(On)))
  return str(c)

 Ie., explicitly set session_dbm to some other location than default.
 Without this the test can fail if main Apache is run as different
 account to what test is run as. I put database in /tmp under a
 different
 name, but might be better somewhere in the test directory of the source
 code.

 Does this make sense?

Of course, no problem ! I agree with you that it would be better if
the session file was in the local directory, making sure it is removed
before the test runs. Maybe the unit test could open the session dbm
after the test has run to check whether the session is saved, for
additional safety.

Regards,
Nicolas


 That gets rid of one of the failures, now for the others. :-)

 Graham




Re: Change to test_Session_Session_conf() of test/test.py.

2006-02-04 Thread Jim Gallacher

Nicolas Lehuen wrote:

2006/2/4, Graham Dumpleton [EMAIL PROTECTED]:


Jim, Nicolas

Would it make sense to change test_Session_Session_conf() function in
unit tests to something like:

def test_Session_Session_conf(self):

import tempfile
tempdir = tempfile.gettempdir()
database = os.path.join(tempdir,mp_sess_test.dbm)

c = VirtualHost(*,
ServerName(test_Session_Session),
DocumentRoot(DOCUMENT_ROOT),
Directory(DOCUMENT_ROOT,
  PythonOption('session_dbm %s' %
database),
  SetHandler(mod_python),

PythonHandler(tests::Session_Session),
  PythonDebug(On)))
return str(c)

Ie., explicitly set session_dbm to some other location than default.
Without this the test can fail if main Apache is run as different
account to what test is run as. I put database in /tmp under a
different
name, but might be better somewhere in the test directory of the source
code.

Does this make sense?



Of course, no problem ! I agree with you that it would be better if
the session file was in the local directory, making sure it is removed
before the test runs. Maybe the unit test could open the session dbm
after the test has run to check whether the session is saved, for
additional safety.


Good idea. Also, I think any temp files created should be put in the 
local directory and removed after the tests run. The obvious place would 
be test/tmp.


Also, I just realized that we don't have a unit test for FileSession, 
which is my fault, since I didn't write one. I shall rectify that, but 
not for the 3.2.7 release. ;)


Jim