# HG changeset patch # User cmlenz # Date 1118355635 0 # Node ID 45d7bfe64d00abfaeb422c4b7a277cae7f264d85 # Parent 8442bcb47a03fe7330c717ec1e87b45eb25344c3 Slightly improved implementation of the python tools. diff --git a/bitten/recipe/pythontools.py b/bitten/recipe/pythontools.py --- a/bitten/recipe/pythontools.py +++ b/bitten/recipe/pythontools.py @@ -29,14 +29,18 @@ pipe = Popen3(cmdline, capturestderr=True) # FIXME: Windows compatibility while True: retval = pipe.poll() + while True: + line = pipe.fromchild.readline() + if not line: + break + print '[distutils] %s' % line.rstrip() + while True: + line = pipe.childerr.readline() + if not line: + break + print '[distutils] %s' % line.rstrip() if retval != -1: break - line = pipe.fromchild.readline() - if line: - print '[distutils] %s' % line.rstrip() - line = pipe.childerr.readline() - if line: - print '[distutils] %s' % line.rstrip() if retval != 0: raise BuildError, "Executing distutils failed (%s)" % retval @@ -53,6 +57,7 @@ if filename.startswith(basedir): filename = filename[len(basedir) + 1:] lineno = int(match.group('line')) + # TODO: emit to build master def trace(basedir, summary=None, coverdir=None, include=None, exclude=None): """Extract data from a `trac.py` run.""" @@ -62,3 +67,15 @@ def unittest(basedir, file=None): """Extract data from a unittest results file in XML format.""" assert file, 'Missing required attribute "file"' + + from xml.dom import minidom + root = minidom.parse(open(file, 'r')).documentElement + assert root.tagName == 'unittest-results' + for test in root.getElementsByTagName('test'): + filename = test.getAttribute('file') + if filename.startswith(basedir): + filename = filename[len(basedir) + 1:] + duration = float(test.getAttribute('duration')) + name = test.getAttribute('name') + status = test.getAttribute('status') + # TODO: emit to build master diff --git a/scripts/build.py b/scripts/build.py --- a/scripts/build.py +++ b/scripts/build.py @@ -40,11 +40,12 @@ steps_run.append(step.id) if step_id and not step_id in steps_run: - raise BuildError, "Recipe has no step named '%s'" % step_id + raise BuildError, 'Recipe has no step named "%s"' % step_id if __name__ == '__main__': try: build() except BuildError, e: - print>>sys.stderr, "FAILED: %s" % e + print>>sys.stderr, 'FAILED: %s' % e sys.exit(-1) + print 'SUCCESS'