Package test_suite :: Module clean_up
[hide private]
[frames] | no frames]

Module clean_up

source code

Module of functions for cleaning up after the tests.

Functions [hide private]
 
deletion(obj=None, name=None, dir=False)
Cleanly removing files and directories, handling WindowsErrors.
source code
Variables [hide private]
  __package__ = 'test_suite'

Imports: rmtree, sleep, delete


Function Details [hide private]

deletion(obj=None, name=None, dir=False)

source code 

Cleanly removing files and directories, handling WindowsErrors.

The problem of MS Windows not releasing the file handle on a close() call is handled. This method should be resilient to the strange MS Windows behaviour of not releasing the relax state files. It should complete even when this WindowsError occurs. A delay of 3 seconds has been added when the WindowsError occurs to give the OS some time before attempting to delete the directory or file again. If this fails the deletion operation is skipped.

Parameters:
  • obj (Python object) - The base object containing the file or directory name variable.
  • name (str) - The name of the file or directory name variable.
  • dir - A flag which if True indicates that a directory should be removed. Otherwise a file should be deleted.