Jim Gallacher wrote:
Graham Dumpleton wrote:
Jim Gallacher wrote ..
I'm getting a unit test failure.
FAIL: test_publisher_cache (__main__.PerRequestTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line 1836, in test_publisher_cache
self.fail(
File "/usr/lib/python2.3/unittest.py", line 270, in fail
raise self.failureException, msg
AssertionError: The publisher cache has reloaded a published module even
though it wasn't modified !
Although it's not related to the failure I'd avoid the use of
time.clock() in the test function as the behaviour is different on
Windows and UNIX, which always makes me nervous. I'd prefer a simple
time.time().
It isn't time.time().
I wasn't suggesting time.clock() was the problem, just that I'd prefer
any function we use in the unit tests has identical behaviour on all
platforms, at least to the extent that is possible.
It is because you probably have a prefork/worker MPM.
The test as written will only reliably work for winnt MPM.
Doh! Prefork bites us in the a** yet again. :)
On UNIX boxes
the subsequent requests could be handled by a different child process.
The configuration as to how many servers to start is:
IfModule("prefork.c",
StartServers("3"),
MaxSpareServers("1")),
IfModule("worker.c",
StartServers("2"),
MaxClients("6"),
MinSpareThreads("1"),
MaxSpareThreads("1"),
ThreadsPerChild("3"),
MaxRequestsPerChild("0")),
Does that make sense, or did I miss something.
Yes, that makes sense. Testing it now.
I can't seem to get the publisher_cache test to work for mpm-prefork,
and I'm thinking it may not be possible to do so for the test as it's
currently conceived. I don't see any way that we can guarantee that the
same child process will serve each request in this test. Perhaps someone
else can take a look before my head explodes.
Jim