show detailed gateway setup info only with "--verbose" or "-v"

This commit is contained in:
holger krekel
2010-07-07 16:44:12 +02:00
parent 9aa1df89ee
commit c0b2df1a77
4 changed files with 22 additions and 10 deletions

View File

@@ -8,6 +8,9 @@
- depend on execnet-1.0.7 which adds "env1:NAME=value" keys to - depend on execnet-1.0.7 which adds "env1:NAME=value" keys to
gateway specification strings. gateway specification strings.
- show detailed gateway setup and platform information only when
"-v" or "--verbose" is specified.
1.3 1.3
------------------------- -------------------------

View File

@@ -15,7 +15,7 @@ class TestDistribution:
py.test.skip("hello") py.test.skip("hello")
""", """,
) )
result = testdir.runpytest(p1, '-d', '--tx=popen', '--tx=popen') result = testdir.runpytest(p1, "-v", '-d', '--tx=popen', '--tx=popen')
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*0*popen*Python*", "*0*popen*Python*",
"*1*popen*Python*", "*1*popen*Python*",
@@ -39,7 +39,7 @@ class TestDistribution:
testdir.makeconftest(""" testdir.makeconftest("""
option_tx = 'popen popen popen'.split() option_tx = 'popen popen popen'.split()
""") """)
result = testdir.runpytest(p1, '-d') result = testdir.runpytest(p1, '-d', "-v")
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*0*popen*Python*", "*0*popen*Python*",
"*1*popen*Python*", "*1*popen*Python*",
@@ -70,7 +70,7 @@ class TestDistribution:
os.kill(os.getpid(), 15) os.kill(os.getpid(), 15)
""" """
) )
result = testdir.runpytest(p1, '-d', '--tx=3*popen') result = testdir.runpytest(p1, "-v", '-d', '--tx=3*popen')
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*popen*Python*", "*popen*Python*",
"*popen*Python*", "*popen*Python*",
@@ -87,7 +87,7 @@ class TestDistribution:
subdir.ensure("__init__.py") subdir.ensure("__init__.py")
p = subdir.join("test_one.py") p = subdir.join("test_one.py")
p.write("def test_5(): assert not __file__.startswith(%r)" % str(p)) p.write("def test_5(): assert not __file__.startswith(%r)" % str(p))
result = testdir.runpytest("-d", "--rsyncdir=%(subdir)s" % locals(), result = testdir.runpytest("-v", "-d", "--rsyncdir=%(subdir)s" % locals(),
"--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([
@@ -112,7 +112,7 @@ class TestDistribution:
print("%s...%s" % sys.version_info[:2]) print("%s...%s" % sys.version_info[:2])
assert 0 assert 0
""") """)
args = ["--dist=each"] args = ["--dist=each", "-v"]
args += ["--tx", "popen//python=%s" % interpreters[0]] args += ["--tx", "popen//python=%s" % interpreters[0]]
args += ["--tx", "popen//python=%s" % interpreters[1]] args += ["--tx", "popen//python=%s" % interpreters[1]]
result = testdir.runpytest(*args) result = testdir.runpytest(*args)
@@ -147,7 +147,7 @@ class TestDistribution:
'calculated result is %s' % calc_result) 'calculated result is %s' % calc_result)
""") """)
p1 = testdir.makepyfile("def test_func(): pass") p1 = testdir.makepyfile("def test_func(): pass")
result = testdir.runpytest(p1, '-d', '--tx=popen') result = testdir.runpytest("-v", p1, '-d', '--tx=popen')
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*popen*Python*", "*popen*Python*",
"*calculated result is 49*", "*calculated result is 49*",

View File

@@ -100,9 +100,12 @@ class DSession(session.Session):
return exitstatus return exitstatus
def collect_all_items(self, colitems): def collect_all_items(self, colitems):
self.report_line("[master] starting full item collection ...") verbose = self.config.getvalue("verbose")
if verbose:
self.report_line("[master] starting full item collection ...")
allitems = list(self.collect(colitems)) allitems = list(self.collect(colitems))
self.report_line("[master] collected %d items" %(len(allitems))) if verbose:
self.report_line("[master] collected %d items" %(len(allitems)))
return allitems return allitems
def loop_once(self, loopstate): def loop_once(self, loopstate):
@@ -286,6 +289,9 @@ class DSession(session.Session):
def setup(self): def setup(self):
""" setup any neccessary resources ahead of the test run. """ """ setup any neccessary resources ahead of the test run. """
if not self.config.getvalue("verbose"):
self.report_line("instantiating gateways (use -v for details): %s" %
",".join(self.config.option.tx))
self.nodemanager = NodeManager(self.config) self.nodemanager = NodeManager(self.config)
self.nodemanager.setup_nodes(putevent=self.queue.put) self.nodemanager.setup_nodes(putevent=self.queue.put)

View File

@@ -294,11 +294,14 @@ class TerminalDistReporter:
"Python %(version)s " "Python %(version)s "
"cwd: %(cwd)s" "cwd: %(cwd)s"
"%(extra)s" % d) "%(extra)s" % d)
self.write_line(infoline) if self.config.getvalue("verbose"):
self.write_line(infoline)
self.gateway2info[gateway] = infoline self.gateway2info[gateway] = infoline
def pytest_testnodeready(self, node): def pytest_testnodeready(self, node):
self.write_line("[%s] txnode ready to receive tests" %(node.gateway.id,)) if self.config.getvalue("verbose"):
self.write_line(
"[%s] txnode ready to receive tests" %(node.gateway.id,))
def pytest_testnodedown(self, node, error): def pytest_testnodedown(self, node, error):
if not error: if not error: