SeattleTestbed / seash

Interactive vessel management tool
MIT License
0 stars 10 forks source link

`subprocess` unit test exception on Windows Vista #95

Open aaaaalbert opened 8 years ago

aaaaalbert commented 8 years ago

@Ashmita89 reports that ut_seash_subprocess.py (not really a test, but a test support script) fails on her Windows Vista machine. It looks as if the test nodemanager that this script starts does not stop quickly enough and thus doesn't release its file handles in time for the script to clean up.

Traceback

C:\Users\Ashmita\seash\RUNNABLE>python utf.py -f  ut_seash_allmodules.py
Testing module: seash
Now starting subprocess: ut_seash_subprocess.py
Generating user keys...
Generating owner key...
Writing config file...
Writing vessel dictionary...
Now running setup script: ut_seash_setup.py
        Running: ut_seash_setup.py                                  [ PASS ]
        Running: ut_seash_allmodules.py                             [ PASS ]
Now stopping subprocess: ut_seash_subprocess.py
Removing: v1
Removing: v10
Removing: v2
Traceback (most recent call last):
  File "ut_seash_subprocess.py", line 53, in <module>
    shutil.rmtree(vesseldirectoryname)
  File "C:\Python26\lib\shutil.py", line 221, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "C:\Python26\lib\shutil.py", line 219, in rmtree
    os.remove(fullname)
WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: 'v2\\nodemanager.old'

C:\Users\Ashmita\seash\RUNNABLE>

Proposed fix

sleep for a few seconds after killing the nodemanager process, and/or retry deleting the file multiple times on encountering WindowsErrors.