1
"""Support code for distutils test cases."""
6
from distutils import log
9
class LoggingSilencer(object):
13
self.threshold = log.set_threshold(log.FATAL)
16
log.set_threshold(self.threshold)
20
class TempdirManager(object):
21
"""Mix-in class that handles temporary directories for test cases.
23
This is intended to be used with unittest.TestCase.
33
d = self.tempdirs.pop()
34
shutil.rmtree(d, os.name in ('nt', 'cygwin'))
37
"""Create a temporary directory that will be cleaned up.
39
Returns the path of the directory.
41
d = tempfile.mkdtemp()
42
self.tempdirs.append(d)
45
def write_file(self, path, content):
46
"""Writes a file in the given path.
49
path can be a string or a sequence.
51
if isinstance(path, (list, tuple)):
52
path = os.path.join(*path)
60
"""Class to store options for retrieval via set_undefined_options()."""
62
def __init__(self, **kwargs):
63
for kw, val in kwargs.items():
64
setattr(self, kw, val)
66
def ensure_finalized(self):