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