mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Create a db_home directory with a unique name so multiple users can
run the test simultaneously. The simplest thing I found that worked on both Windows and Unix was to use the PID. It's unique so should be sufficient. This should prevent many of the spurious failures of the automated tests since they run as different users. Also cleanup the directory consistenly in the tearDown methods. It would be nice if someone ensured that the directories are always created with a consistent name.
This commit is contained in:
parent
6a123cb782
commit
6057b2e645
17 changed files with 72 additions and 78 deletions
|
@ -9,6 +9,7 @@ import socket
|
|||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import warnings
|
||||
import unittest
|
||||
|
||||
|
@ -64,6 +65,14 @@ def unlink(filename):
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
def rmtree(path):
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except OSError, e:
|
||||
# Unix returns ENOENT, Windows returns ESRCH.
|
||||
if e.errno not in (errno.ENOENT, errno.ESRCH):
|
||||
raise
|
||||
|
||||
def forget(modname):
|
||||
'''"Forget" a module was ever imported by removing it from sys.modules and
|
||||
deleting any .pyc and .pyo files.'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue