[svn r63193] normalize towards 'iocapture' option
--HG-- branch : trunk
This commit is contained in:
parent
3902890e1b
commit
0ba4bd25ac
|
@ -242,7 +242,7 @@ class Config(object):
|
|||
if self.option.nocapture:
|
||||
iocapture = "no"
|
||||
else:
|
||||
iocapture = self.getvalue("conf_iocapture", path=path)
|
||||
iocapture = self.getvalue("iocapture", path=path)
|
||||
if iocapture == "fd":
|
||||
return py.io.StdCaptureFD()
|
||||
elif iocapture == "sys":
|
||||
|
@ -250,7 +250,7 @@ class Config(object):
|
|||
elif iocapture == "no":
|
||||
return py.io.StdCapture(out=False, err=False, in_=False)
|
||||
else:
|
||||
raise ValueError("unknown io capturing: " + iocapture)
|
||||
raise self.Error("unknown io capturing: " + iocapture)
|
||||
|
||||
def getxspecs(self):
|
||||
config = self
|
||||
|
|
|
@ -8,14 +8,12 @@ Generator = py.test.collect.Generator
|
|||
Function = py.test.collect.Function
|
||||
Instance = py.test.collect.Instance
|
||||
|
||||
conf_iocapture = "fd" # overridable from conftest.py
|
||||
|
||||
pytest_plugins = "default terminal xfail tmpdir execnetcleanup monkeypatch".split()
|
||||
|
||||
# ===================================================
|
||||
# settings in conftest only (for now) - for distribution
|
||||
|
||||
dist_boxed = False
|
||||
if hasattr(py.std.os, 'nice'):
|
||||
dist_nicelevel = py.std.os.nice(0) # nice py.test works
|
||||
else:
|
||||
|
|
|
@ -68,7 +68,7 @@ class TestAsyncFunctional:
|
|||
"--tx=popen//chdir=%(dest)s" % locals(), p)
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1* new *popen*platform*",
|
||||
"*1* *popen*platform*",
|
||||
#"RSyncStart: [G1]",
|
||||
#"RSyncFinished: [G1]",
|
||||
"*1 passed*"
|
||||
|
|
|
@ -33,7 +33,7 @@ class DefaultPlugin:
|
|||
return Directory(path, parent=parent)
|
||||
|
||||
def pytest_addoption(self, parser):
|
||||
group = parser.addgroup("general", "test selection and failure debug options")
|
||||
group = parser.addgroup("general", "general test process options")
|
||||
group._addoption('-v', '--verbose', action="count",
|
||||
dest="verbose", default=0, help="increase verbosity."),
|
||||
group._addoption('-x', '--exitfirst',
|
||||
|
@ -61,9 +61,11 @@ class DefaultPlugin:
|
|||
group._addoption('--fulltrace',
|
||||
action="store_true", dest="fulltrace", default=False,
|
||||
help="don't cut any tracebacks (default is to cut).")
|
||||
group._addoption('-s', '--nocapture',
|
||||
group._addoption('-s',
|
||||
action="store_true", dest="nocapture", default=False,
|
||||
help="disable catching of sys.stdout/stderr output."),
|
||||
help="disable catching of stdout/stderr during test run.")
|
||||
group._addoption('--iocapture', action="store", default="fd", metavar="method",
|
||||
help="set iocapturing method: fd|sys|no.")
|
||||
group.addoption('--basetemp', dest="basetemp", default=None, metavar="dir",
|
||||
help="temporary directory for this test run.")
|
||||
group.addoption('--boxed',
|
||||
|
@ -75,7 +77,7 @@ class DefaultPlugin:
|
|||
"and instantiate 'HelloPlugin' from the module."))
|
||||
group._addoption('-f', '--looponfailing',
|
||||
action="store_true", dest="looponfailing", default=False,
|
||||
help="loop on failing test set.")
|
||||
help="run tests, loop on failing test set, until all pass. repeat forever.")
|
||||
|
||||
group = parser.addgroup("test process debugging")
|
||||
group.addoption('--collectonly',
|
||||
|
|
|
@ -96,7 +96,7 @@ class TerminalReporter:
|
|||
else:
|
||||
d['extra'] = ""
|
||||
d['cwd'] = rinfo.cwd
|
||||
self.write_line("%(id)s new %(spec)r -- platform %(platform)s, "
|
||||
self.write_line("%(id)s %(spec)s -- platform %(platform)s, "
|
||||
"Python %(version)s "
|
||||
"cwd: %(cwd)s"
|
||||
"%(extra)s" % d)
|
||||
|
@ -460,7 +460,7 @@ class TestTerminal:
|
|||
|
||||
rep.pyevent_gwmanage_newgateway(gw1, rinfo)
|
||||
linecomp.assert_contains_lines([
|
||||
"X1 new 'popen' *xyz*2.5*"
|
||||
"X1*popen*xyz*2.5*"
|
||||
])
|
||||
|
||||
rep.pyevent_gwmanage_rsyncstart(source="hello", gateways=[gw1, gw2])
|
||||
|
|
|
@ -236,13 +236,13 @@ class TestOptionEffects:
|
|||
|
||||
def test_config_iocapturing(self, testdir):
|
||||
config = testdir.parseconfig(testdir.tmpdir)
|
||||
assert config.getvalue("conf_iocapture")
|
||||
assert config.getvalue("iocapture")
|
||||
tmpdir = testdir.tmpdir.ensure("sub-with-conftest", dir=1)
|
||||
tmpdir.join("conftest.py").write(py.code.Source("""
|
||||
conf_iocapture = "no"
|
||||
pytest_option_iocapture = "no"
|
||||
"""))
|
||||
config = py.test.config._reparse([tmpdir])
|
||||
assert config.getvalue("conf_iocapture") == "no"
|
||||
assert config.getvalue("iocapture") == "no"
|
||||
capture = config._getcapture()
|
||||
assert isinstance(capture, py.io.StdCapture)
|
||||
assert not capture._out
|
||||
|
@ -252,7 +252,7 @@ class TestOptionEffects:
|
|||
for opt, cls in (("sys", py.io.StdCapture),
|
||||
("fd", py.io.StdCaptureFD),
|
||||
):
|
||||
config.option.conf_iocapture = opt
|
||||
config.option.iocapture = opt
|
||||
capture = config._getcapture()
|
||||
assert isinstance(capture, cls)
|
||||
|
||||
|
|
Loading…
Reference in New Issue