On 5/16/2011 11:47 AM, Emmanuel Blot wrote:
It seems that the temporary path is not transcient: it's the very same
path across multiple test sessions... Maybe a bad use of mkstemp() or
the like?
Ok, something weird:
The temporary env path is created as:
         env_path = os.path.join(tempfile.gettempdir(), 'trac-tempenv')
which means that it's not possible to run more than one test session
at once on the same machine, as the temporary directory is the very
same for all instances.

Moreover, when the temporary directory already exists, many setUp()
TestCase methods fail to execute.
When setUp() aborts, tearDown() is never called by the Python unittest
framework, and the existing directory is never cleared up. This issue
makes any subsequent test session to fail as well.

I would suggest that the temporary directory is unique for a single
test session, which would solve the first issue and reduce the
occurrences of the second one.


Ok, but I think we should first find a way to ensure a proper deletion of such environments in case of failure, otherwise they'll accumulate. The current behavior, while not optimal, makes it at least easy to detect and fix (rm -fr ...) such leaked environments.

Also, we have a similar situation with test environments created by the functional tests, they also use a fixed location (source tree + '/testenv/trac'), and there we use the approach of doing a destroy() first followed by a create(). This is avoids leaking more than one environment but obviously only works when reusing the same testenv, which makes it impossible to have concurrent runs. Here as well we must be sure to have a robust cleanup procedure if we want to change this.

-- Christian

--
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to