Test suite does not close db files

Bug #841273 reported by Martin Packman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned
Bazaar Git Plugin
Triaged
Medium
Unassigned
Bazaar Subversion Plugin
Fix Released
Medium
Jelmer Vernooij
Breezy
Triaged
Medium
Unassigned

Bug Description

Running the bzr-git test suite on windows, where the default behaviour is to prevent the deletion of an open file, causes lots of spam along the lines of:

While running: bzrlib.plugins.git.tests.test_blackbox.TestGitBlackBox.test_branch
Unable to remove testing dir ox.TestGitBlackBox.test_branch
[Error 32] The process cannot access the file because it is being used by another process: u'%TMP%/testbzr-qvp8yp.tmp/ox.TestGitBlackBox.test_branch\\work\\bzrbranch\\.bzr\\repository\\git\\idmap.db'

When a temporary db is created, it should be closed and deleted as part of the test cleanup, rather than relying on posix file removal semantics.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Ideally we should just clear the contents of the cache database dictionary after every test.

Is there an easy way to register an cleanup command for bzr's TestCaseWithTransport, from outside of the class?

Changed in bzr-git:
status: New → Confirmed
status: Confirmed → Triaged
importance: Undecided → Medium
tags: added: selftest windows
Revision history for this message
Martin Packman (gz) wrote :

I noticed after filing this that a seemly related problem had been mentioned in the comments of bug 734145 by Eli, which suggests this may not be a test-only issue?

<https://bugs.launchpad.net/bzr-git/+bug/734145/comments/14>

In which case a general cache cleanup mechanism is needed?

Otherwise, the tests really need to use TestCase.addCleanup within the context test run, it can't really be done from code elsewhere (though the logic can live wherever).

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Yeah, a general cache cleanup mechanism would probably be easiest - we could call that from TestCase.addCleanup.

We can't use TestCase.addCleanup directly to close bzr-git cache files. A lot of the tests don't know about bzr-git - they simply iterate over all available format s and create instances of those formats, bzr-git doesn't have access to the actual TestCase instance.

Changed in bzr:
status: New → Triaged
importance: Undecided → Medium
importance: Medium → Low
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Note that this is specifically an issue with the current cache formats.

I have plans to migrate to a bzr pack based format, which wouldn't need process-wide caching of the database handles. That requires some improvements to the pack infrastructure first though.

Changed in bzr-svn:
status: New → Triaged
Changed in bzr:
status: Triaged → Confirmed
Changed in bzr-svn:
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
status: Triaged → Fix Released
assignee: nobody → Jelmer Vernooij (jelmer)
milestone: none → 1.1.1
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in brz-git:
status: New → Triaged
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Jelmer Vernooij (jelmer)
affects: brz-git → brz
tags: added: git
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.