[New-bugs-announce] [issue15496] harden directory removal for tests on Windows

Jeremy Kloth report at bugs.python.org
Mon Jul 30 04:14:55 CEST 2012


New submission from Jeremy Kloth:

Currently, removing directories during testing on Windows w/NTFS can causing sporadic failures due to access denied errors.  This is caused by other processes getting a handle to the directory itself (change notifications) or a handle to a file within the directory.  The most notable offender is the Indexing Service.

Most (but not all!) external programs can be configured to ignore the development directory.  For example, the Indexing Service can be disabled or have those directories ignored.  TortoiseSVN is another offender that can exclude directories but each directory needs to be listed separately so it is easy to forgot one.  On my machine I have programs that simply do not have an option to ignore any directories thus causing some grief during testing.

The attached patch to test.support eliminates the need to disable or and ignores to any programs (tested on a Win7-x64 i7-3770K at 4.3GHz).

It achieves this by checking for the removal of the directory before returning to the caller.  It performs an exponential backoff timeout loop that amounts to a total of ~1 second in the worst case.  If the directory is not removed from the filesystem by then, it will probably be in error anyway.  However, the loop is seldom executed more than once.

----------
components: Tests
files: support.diff
keywords: patch
messages: 166853
nosy: jkloth
priority: normal
severity: normal
status: open
title: harden directory removal for tests on Windows
type: enhancement
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file26590/support.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15496>
_______________________________________


More information about the New-bugs-announce mailing list