コード例 #1
0
ファイル: subunit_1to2.py プロジェクト: mtreinish/pysubunit
def main():
    parser = make_options(__doc__)
    (options, args) = parser.parse_args()
    filters.run_tests_from_stream(
        filters.find_stream(sys.stdin, args),
        testtools.ExtendedToStreamDecorator(
            pysubunit.StreamResultToBytes(sys.stdout)))
    sys.exit(0)
コード例 #2
0
def main():
    parser = make_options(__doc__)
    (options, args) = parser.parse_args()
    case = pysubunit.ByteStreamToStreamResult(filters.find_stream(
        sys.stdin, args),
                                              non_subunit_name='stdout')
    result = testtools.StreamToExtendedDecorator(
        pysubunit.decoratedTestProtocolClient(sys.stdout))
    result = testtools.StreamResultRouter(result)
    cat = test_results.CatFiles(sys.stdout)
    result.add_rule(cat, 'test_id', test_id=None)
    result.startTestRun()
    case.run(result)
    result.stopTestRun()
    sys.exit(0)
コード例 #3
0
def main():
    parser = make_options(__doc__)
    (options, args) = parser.parse_args()

    regexp_filter = _make_regexp_filter(options.with_regexps,
                                        options.without_regexps)
    tag_filter = test_results.make_tag_filter(options.with_tags,
                                              options.without_tags)
    filter_predicate = test_results.and_predicates([regexp_filter, tag_filter])

    filters.filter_by_result(
        lambda output_to: _make_result(sys.stdout, options, filter_predicate),
        output_path=None,
        passthrough=(not options.no_passthrough),
        forward=False,
        protocol_version=2,
        input_stream=filters.find_stream(sys.stdin, args))
    sys.exit(0)
コード例 #4
0
ファイル: subunit_ls.py プロジェクト: mtreinish/pysubunit
def main():
    parser = optparse.OptionParser(description=__doc__)
    parser.add_option(
        "--times",
        action="store_true",
        help="list the time each test took (requires a timestamped stream)",
        default=False)
    parser.add_option(
        "--exists",
        action="store_true",
        help="list tests that are reported as existing (as well as ran)",
        default=False)
    parser.add_option("--no-passthrough",
                      action="store_true",
                      help="Hide all non subunit input.",
                      default=False,
                      dest="no_passthrough")
    (options, args) = parser.parse_args()
    test = pysubunit.ByteStreamToStreamResult(filters.find_stream(
        sys.stdin, args),
                                              non_subunit_name="stdout")
    result = test_results.TestIdPrintingResult(sys.stdout, options.times,
                                               options.exists)
    if not options.no_passthrough:
        result = testtools.StreamResultRouter(result)
        cat = test_results.CatFiles(sys.stdout)
        result.add_rule(cat, 'test_id', test_id=None)
    summary = testtools.StreamSummary()
    result = testtools.CopyStreamResult([result, summary])
    result.startTestRun()
    test.run(result)
    result.stopTestRun()
    if summary.wasSuccessful():
        exit_code = 0
    else:
        exit_code = 1
    sys.exit(exit_code)
コード例 #5
0
ファイル: test_filters.py プロジェクト: mtreinish/pysubunit
 def test_opens_file(self):
     f = tempfile.NamedTemporaryFile()
     f.write(b'foo')
     f.flush()
     stream = filters.find_stream('bar', [f.name])
     self.assertEqual(b'foo', stream.read())
コード例 #6
0
ファイル: test_filters.py プロジェクト: mtreinish/pysubunit
 def test_no_argv(self):
     self.assertEqual('foo', filters.find_stream('foo', []))