[svn r63195] * fix rsyncdir usages all around
* rename looponfailing to looponfail --HG-- branch : trunk
This commit is contained in:
parent
87f6f6b9f4
commit
422635ea47
|
@ -267,21 +267,18 @@ class Config(object):
|
|||
|
||||
def getrsyncdirs(self):
|
||||
config = self
|
||||
roots = config.option.rsyncdirs
|
||||
if roots:
|
||||
roots = [py.path.local(x) for x in roots.split(',')]
|
||||
else:
|
||||
roots = []
|
||||
roots = config.option.rsyncdir
|
||||
conftestroots = config.getconftest_pathlist("rsyncdirs")
|
||||
if conftestroots:
|
||||
roots.extend(conftestroots)
|
||||
pydir = py.path.local(py.__file__).dirpath()
|
||||
roots = [py.path.local(root) for root in roots]
|
||||
for root in roots:
|
||||
if not root.check():
|
||||
raise ValueError("rsyncdir doesn't exist: %r" %(root,))
|
||||
raise config.Error("rsyncdir doesn't exist: %r" %(root,))
|
||||
if pydir is not None and root.basename == "py":
|
||||
if root != pydir:
|
||||
raise ValueError("root %r conflicts with current %r" %(root, pydir))
|
||||
raise config.Error("root %r conflicts with imported %r" %(root, pydir))
|
||||
pydir = None
|
||||
if pydir is not None:
|
||||
roots.append(pydir)
|
||||
|
|
|
@ -64,7 +64,7 @@ class TestAsyncFunctional:
|
|||
subdir.ensure("__init__.py")
|
||||
p = subdir.join("test_one.py")
|
||||
p.write("def test_5(): assert not __file__.startswith(%r)" % str(p))
|
||||
result = testdir.runpytest("-d", "--rsyncdirs=%(subdir)s" % locals(),
|
||||
result = testdir.runpytest("-d", "--rsyncdir=%(subdir)s" % locals(),
|
||||
"--tx=popen//chdir=%(dest)s" % locals(), p)
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
|
|
|
@ -36,7 +36,7 @@ class TestNodeManager:
|
|||
dest.remove()
|
||||
nodemanager = NodeManager(testdir.parseconfig(
|
||||
"--tx", "popen//chdir=%s" % dest,
|
||||
"--rsyncdirs", rsyncroot,
|
||||
"--rsyncdir", rsyncroot,
|
||||
source,
|
||||
))
|
||||
assert nodemanager.config.topdir == source
|
||||
|
@ -112,7 +112,7 @@ class TestNodeManager:
|
|||
def test_one():
|
||||
pass
|
||||
""")
|
||||
sorter = testdir.inline_run("-d", "--rsyncdirs=%s" % testdir.tmpdir,
|
||||
sorter = testdir.inline_run("-d", "--rsyncdir=%s" % testdir.tmpdir,
|
||||
"--tx=%s" % specssh, testdir.tmpdir)
|
||||
ev = sorter.getfirstnamed("itemtestreport")
|
||||
assert ev.passed
|
||||
|
@ -133,7 +133,7 @@ class TestOptionsAndConfiguration:
|
|||
assert xspecs[1].ssh == "xyz"
|
||||
|
||||
def test_getconfigroots(self, testdir):
|
||||
config = testdir.parseconfig('--rsyncdirs=' + str(testdir.tmpdir))
|
||||
config = testdir.parseconfig('--rsyncdir=' + str(testdir.tmpdir))
|
||||
roots = config.getrsyncdirs()
|
||||
assert len(roots) == 1 + 1
|
||||
assert testdir.tmpdir in roots
|
||||
|
@ -146,7 +146,7 @@ class TestOptionsAndConfiguration:
|
|||
testdir.makeconftest("""
|
||||
rsyncdirs= 'x',
|
||||
""")
|
||||
config = testdir.parseconfig(testdir.tmpdir, '--rsyncdirs=y,z')
|
||||
config = testdir.parseconfig(testdir.tmpdir, '--rsyncdir=y', '--rsyncdir=z')
|
||||
roots = config.getrsyncdirs()
|
||||
assert len(roots) == 3 + 1
|
||||
assert py.path.local('y') in roots
|
||||
|
|
|
@ -115,7 +115,7 @@ def slave_runsession(channel, config, fullwidth, hasmarkup):
|
|||
|
||||
DEBUG("SLAVE: received configuration, using topdir:", config.topdir)
|
||||
#config.option.session = None
|
||||
config.option.looponfailing = False
|
||||
config.option.looponfail = False
|
||||
config.option.usepdb = False
|
||||
trails = channel.receive()
|
||||
config.pytestplugins.do_configure(config)
|
||||
|
@ -150,5 +150,5 @@ def slave_runsession(channel, config, fullwidth, hasmarkup):
|
|||
DEBUG("SLAVE: starting session.main()")
|
||||
session.main(colitems)
|
||||
ev = event.LooponfailingInfo(list(failreports), [config.topdir])
|
||||
session.bus.notify("looponfailinginfo", ev)
|
||||
session.bus.notify("looponfailinfo", ev)
|
||||
channel.send([x.colitem._totrail() for x in failreports if x.failed])
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestRemoteControl:
|
|||
assert str(failures).find("test_new") != -1
|
||||
|
||||
class TestLooponFailing:
|
||||
def test_looponfailing_from_fail_to_ok(self, testdir):
|
||||
def test_looponfail_from_fail_to_ok(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def test_one():
|
||||
x = 0
|
||||
|
@ -71,7 +71,7 @@ class TestLooponFailing:
|
|||
session.loop_once(loopstate)
|
||||
assert not loopstate.colitems
|
||||
|
||||
def test_looponfailing_from_one_to_two_tests(self, testdir):
|
||||
def test_looponfail_from_one_to_two_tests(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def test_one():
|
||||
assert 0
|
||||
|
@ -96,7 +96,7 @@ class TestLooponFailing:
|
|||
session.loop_once(loopstate)
|
||||
assert len(loopstate.colitems) == 1
|
||||
|
||||
def test_looponfailing_removed_test(self, testdir):
|
||||
def test_looponfail_removed_test(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def test_one():
|
||||
assert 0
|
||||
|
|
|
@ -75,8 +75,8 @@ class DefaultPlugin:
|
|||
help=("load the specified plugin after command line parsing. "
|
||||
"Example: '-p hello' will trigger 'import pytest_hello' "
|
||||
"and instantiate 'HelloPlugin' from the module."))
|
||||
group._addoption('-f', '--looponfailing',
|
||||
action="store_true", dest="looponfailing", default=False,
|
||||
group._addoption('-f', '--looponfail',
|
||||
action="store_true", dest="looponfail", default=False,
|
||||
help="run tests, loop on failing test set, until all pass. repeat forever.")
|
||||
|
||||
group = parser.addgroup("test process debugging")
|
||||
|
@ -116,8 +116,8 @@ class DefaultPlugin:
|
|||
|
||||
def fixoptions(self, config):
|
||||
if config.getvalue("usepdb"):
|
||||
if config.getvalue("looponfailing"):
|
||||
raise config.Error("--pdb incompatible with --looponfailing.")
|
||||
if config.getvalue("looponfail"):
|
||||
raise config.Error("--pdb incompatible with --looponfail.")
|
||||
if config.getvalue("dist"):
|
||||
raise config.Error("--pdb incomptaible with distributed testing.")
|
||||
|
||||
|
@ -132,7 +132,7 @@ class DefaultPlugin:
|
|||
from py.__.test.session import Session
|
||||
config.setsessionclass(Session)
|
||||
else:
|
||||
if val("looponfailing"):
|
||||
if val("looponfail"):
|
||||
from py.__.test.looponfail.remote import LooponfailingSession
|
||||
config.setsessionclass(LooponfailingSession)
|
||||
elif val("numprocesses") or val("dist"):
|
||||
|
@ -179,7 +179,7 @@ def test_conflict_options():
|
|||
py.test.raises(config.Error,
|
||||
"config.pytestplugins.do_configure(config)")
|
||||
conflict_options = (
|
||||
'--looponfailing --pdb',
|
||||
'--looponfail --pdb',
|
||||
'--dist --pdb',
|
||||
)
|
||||
for spec in conflict_options:
|
||||
|
|
|
@ -209,7 +209,7 @@ class PytestPluginHooks:
|
|||
def pyevent_rescheduleitems(self, event):
|
||||
""" Items from a node that went down. """
|
||||
|
||||
def pyevent_looponfailinginfo(self, event):
|
||||
def pyevent_looponfailinfo(self, event):
|
||||
""" info for repeating failing tests. """
|
||||
|
||||
def pyevent_plugin_registered(self, plugin):
|
||||
|
|
|
@ -223,7 +223,7 @@ class TerminalReporter:
|
|||
self.summary_deselected()
|
||||
self.summary_stats()
|
||||
|
||||
def pyevent_looponfailinginfo(self, event):
|
||||
def pyevent_looponfailinfo(self, event):
|
||||
if event.failreports:
|
||||
self.write_sep("#", "LOOPONFAILING", red=True)
|
||||
for report in event.failreports:
|
||||
|
@ -483,7 +483,7 @@ class TestTerminal:
|
|||
assert lines[1].endswith("xy.py .")
|
||||
assert lines[2] == "hello world"
|
||||
|
||||
def test_looponfailingreport(self, testdir, linecomp):
|
||||
def test_looponfailreport(self, testdir, linecomp):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def test_fail():
|
||||
assert 0
|
||||
|
@ -492,10 +492,10 @@ class TestTerminal:
|
|||
""")
|
||||
rep = TerminalReporter(modcol.config, file=linecomp.stringio)
|
||||
reports = [basic_run_report(x) for x in modcol.collect()]
|
||||
rep.pyevent_looponfailinginfo(event.LooponfailingInfo(reports, [modcol.config.topdir]))
|
||||
rep.pyevent_looponfailinfo(event.LooponfailingInfo(reports, [modcol.config.topdir]))
|
||||
linecomp.assert_contains_lines([
|
||||
"*test_looponfailingreport.py:2: assert 0",
|
||||
"*test_looponfailingreport.py:4: ValueError*",
|
||||
"*test_looponfailreport.py:2: assert 0",
|
||||
"*test_looponfailreport.py:4: ValueError*",
|
||||
"*waiting*",
|
||||
"*%s*" % (modcol.config.topdir),
|
||||
])
|
||||
|
|
|
@ -401,24 +401,24 @@ class TestInteractive:
|
|||
if child.isalive():
|
||||
child.wait()
|
||||
|
||||
def test_simple_looponfailing_interaction(self, testdir):
|
||||
def test_simple_looponfail_interaction(self, testdir):
|
||||
spawn = self.getspawn(testdir.tmpdir)
|
||||
p1 = testdir.makepyfile("""
|
||||
def test_1():
|
||||
assert 1 == 0
|
||||
""")
|
||||
p1.setmtime(p1.mtime() - 50.0)
|
||||
child = spawn("%s %s --looponfailing %s" % (py.std.sys.executable, pytestpath, p1))
|
||||
child = spawn("%s %s --looponfail %s" % (py.std.sys.executable, pytestpath, p1))
|
||||
child.timeout = EXPECTTIMEOUT
|
||||
child.expect("assert 1 == 0")
|
||||
child.expect("test_simple_looponfailing_interaction.py:")
|
||||
child.expect("test_simple_looponfail_interaction.py:")
|
||||
child.expect("1 failed")
|
||||
child.expect("waiting for changes")
|
||||
p1.write(py.code.Source("""
|
||||
def test_1():
|
||||
assert 1 == 1
|
||||
"""))
|
||||
child.expect("MODIFIED.*test_simple_looponfailing_interaction.py", timeout=4.0)
|
||||
child.expect("MODIFIED.*test_simple_looponfail_interaction.py", timeout=4.0)
|
||||
child.expect("1 passed", timeout=5.0)
|
||||
child.kill(15)
|
||||
|
||||
|
|
Loading…
Reference in New Issue