[svn r57564] adding an option for setting a tracedirectory so that components can write log files,
depending on what they get from config.gettracedir() --HG-- branch : trunk
This commit is contained in:
parent
89cdf3b8a4
commit
bf42c88e48
|
@ -220,6 +220,12 @@ class Config(object):
|
|||
else:
|
||||
raise ValueError("unknown io capturing: " + iocapture)
|
||||
|
||||
|
||||
def gettracedir(self):
|
||||
""" return a tracedirectory or None, depending on --tracedir. """
|
||||
if self.option.tracedir is not None:
|
||||
return py.path.local(self.option.tracedir)
|
||||
|
||||
# this is the one per-process instance of py.test configuration
|
||||
config_per_process = Config()
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ def adddefaultoptions(config):
|
|||
Option('', '--eventlog',
|
||||
action="store", dest="eventlog", default=None,
|
||||
help="write reporting events to given file."),
|
||||
Option('', '--tracedir',
|
||||
action="store", dest="tracedir", default=None,
|
||||
help="write tracing information to the given directory."),
|
||||
Option('', '--tb',
|
||||
action="store", dest="tbstyle", default='long',
|
||||
type="choice", choices=['long', 'short', 'no'],
|
||||
|
|
|
@ -201,6 +201,14 @@ class TestSessionAndOptions:
|
|||
s = eventlog.read()
|
||||
assert s.find("TestrunStart") != -1
|
||||
|
||||
def test_tracedir(self):
|
||||
tracedir = self.tmpdir.mkdir("tracedir")
|
||||
config = py.test.config._reparse([self.tmpdir,
|
||||
'--tracedir=%s' % tracedir])
|
||||
assert config.gettracedir() == tracedir
|
||||
config = py.test.config._reparse([self.tmpdir])
|
||||
assert config.gettracedir() is None
|
||||
|
||||
def test_implied_dsession(self):
|
||||
for x in 'startserver runbrowser rest'.split():
|
||||
config = py.test.config._reparse([self.tmpdir, '--dist', '--%s' % x])
|
||||
|
|
Loading…
Reference in New Issue