示例#1
0
def main():
    # Disable the default buffering, for Python 2.x where pdb doesn't do it
    # on non-ttys.
    stream = get_default_formatter()
    runner = SubunitTestRunner
    # Patch stdout to be unbuffered, so that pdb works well on 2.6/2.7.
    binstdout = io.open(sys.stdout.fileno(), 'wb', 0)
    if sys.version_info[0] > 2:
        sys.stdout = io.TextIOWrapper(binstdout, encoding=sys.stdout.encoding)
    else:
        sys.stdout = binstdout
    SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner,
        stdout=sys.stdout)
示例#2
0
def main():
    # Disable the default buffering, for Python 2.x where pdb doesn't do it
    # on non-ttys.
    stream = get_default_formatter()
    runner = SubunitTestRunner
    # Patch stdout to be unbuffered, so that pdb works well on 2.6/2.7.
    binstdout = io.open(sys.stdout.fileno(), 'wb', 0)
    if sys.version_info[0] > 2:
        sys.stdout = io.TextIOWrapper(binstdout, encoding=sys.stdout.encoding)
    else:
        sys.stdout = binstdout
    SubunitTestProgram(module=None,
                       argv=sys.argv,
                       testRunner=runner,
                       stdout=sys.stdout)
示例#3
0
文件: run.py 项目: atlant2011/samba

class SubunitTestProgram(TestProgram):

    USAGE = USAGE_AS_MAIN

    def usageExit(self, msg=None):
        if msg:
            print (msg)
        usage = {'progName': self.progName, 'catchbreak': '', 'failfast': '',
                 'buffer': ''}
        if self.failfast != False:
            usage['failfast'] = FAILFAST
        if self.catchbreak != False:
            usage['catchbreak'] = CATCHBREAK
        if self.buffer != False:
            usage['buffer'] = BUFFEROUTPUT
        usage_text = self.USAGE % usage
        usage_lines = usage_text.split('\n')
        usage_lines.insert(2, "Run a test suite with a subunit reporter.")
        usage_lines.insert(3, "")
        print('\n'.join(usage_lines))
        sys.exit(2)


if __name__ == '__main__':
    stream = get_default_formatter()
    runner = SubunitTestRunner(stream)
    SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner,
        stdout=sys.stdout)
示例#4
0
文件: run.py 项目: cpatulea/samba

class SubunitTestProgram(TestProgram):

    USAGE = USAGE_AS_MAIN

    def usageExit(self, msg=None):
        if msg:
            print (msg)
        usage = {'progName': self.progName, 'catchbreak': '', 'failfast': '',
                 'buffer': ''}
        if self.failfast != False:
            usage['failfast'] = FAILFAST
        if self.catchbreak != False:
            usage['catchbreak'] = CATCHBREAK
        if self.buffer != False:
            usage['buffer'] = BUFFEROUTPUT
        usage_text = self.USAGE % usage
        usage_lines = usage_text.split('\n')
        usage_lines.insert(2, "Run a test suite with a subunit reporter.")
        usage_lines.insert(3, "")
        print('\n'.join(usage_lines))
        sys.exit(2)


if __name__ == '__main__':
    stream = get_default_formatter()
    runner = SubunitTestRunner(stream)
    SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner,
        stdout=sys.stdout)