add hg and python
This commit is contained in:
parent
3a742c699f
commit
458120dd40
3709 changed files with 1244309 additions and 1 deletions
sys/lib/python/distutils/tests
54
sys/lib/python/distutils/tests/support.py
Normal file
54
sys/lib/python/distutils/tests/support.py
Normal file
|
@ -0,0 +1,54 @@
|
|||
"""Support code for distutils test cases."""
|
||||
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from distutils import log
|
||||
|
||||
|
||||
class LoggingSilencer(object):
|
||||
|
||||
def setUp(self):
|
||||
super(LoggingSilencer, self).setUp()
|
||||
self.threshold = log.set_threshold(log.FATAL)
|
||||
|
||||
def tearDown(self):
|
||||
log.set_threshold(self.threshold)
|
||||
super(LoggingSilencer, self).tearDown()
|
||||
|
||||
|
||||
class TempdirManager(object):
|
||||
"""Mix-in class that handles temporary directories for test cases.
|
||||
|
||||
This is intended to be used with unittest.TestCase.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TempdirManager, self).setUp()
|
||||
self.tempdirs = []
|
||||
|
||||
def tearDown(self):
|
||||
super(TempdirManager, self).tearDown()
|
||||
while self.tempdirs:
|
||||
d = self.tempdirs.pop()
|
||||
shutil.rmtree(d)
|
||||
|
||||
def mkdtemp(self):
|
||||
"""Create a temporary directory that will be cleaned up.
|
||||
|
||||
Returns the path of the directory.
|
||||
"""
|
||||
d = tempfile.mkdtemp()
|
||||
self.tempdirs.append(d)
|
||||
return d
|
||||
|
||||
|
||||
class DummyCommand:
|
||||
"""Class to store options for retrieval via set_undefined_options()."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
for kw, val in kwargs.items():
|
||||
setattr(self, kw, val)
|
||||
|
||||
def ensure_finalized(self):
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue