/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Add a --transport parameter to the test suite to set the default transport to be used in the test suite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1393
1393
        else:
1394
1394
            print config.username()
1395
1395
 
 
1396
 
1396
1397
class cmd_nick(Command):
1397
1398
    """\
1398
1399
    Print or set the branch nickname.  
1411
1412
    def printme(self, branch):
1412
1413
        print branch.nick 
1413
1414
 
 
1415
 
1414
1416
class cmd_selftest(Command):
1415
1417
    """Run internal test suite.
1416
1418
    
1423
1425
    which tests should run.
1424
1426
    """
1425
1427
    # TODO: --list should give a list of all available tests
 
1428
 
 
1429
    # NB: this is used from the class without creating an instance, which is
 
1430
    # why it does not have a self parameter.
 
1431
    def get_transport_type(typestring):
 
1432
        """Parse and return a transport specifier."""
 
1433
        if typestring == "sftp":
 
1434
            from bzrlib.transport.sftp import SFTPAbsoluteServer
 
1435
            return SFTPAbsoluteServer
 
1436
        msg = "No known transport type %s. Supported types are: sftp\n" %\
 
1437
            (typestring)
 
1438
        raise BzrCommandError(msg)
 
1439
 
1426
1440
    hidden = True
1427
1441
    takes_args = ['testspecs*']
1428
1442
    takes_options = ['verbose', 
1429
1443
                     Option('one', help='stop when one test fails'),
1430
1444
                     Option('keep-output', 
1431
 
                            help='keep output directories when tests fail')
 
1445
                            help='keep output directories when tests fail'),
 
1446
                     Option('transport', 
 
1447
                            help='Use a different transport by default '
 
1448
                                 'throughout the test suite.',
 
1449
                            type=get_transport_type),
1432
1450
                    ]
1433
1451
 
1434
1452
    def run(self, testspecs_list=None, verbose=False, one=False,
1435
 
            keep_output=False):
 
1453
            keep_output=False, transport=None):
1436
1454
        import bzrlib.ui
1437
1455
        from bzrlib.tests import selftest
1438
1456
        # we don't want progress meters from the tests to go to the
1449
1467
            result = selftest(verbose=verbose, 
1450
1468
                              pattern=pattern,
1451
1469
                              stop_on_failure=one, 
1452
 
                              keep_output=keep_output)
 
1470
                              keep_output=keep_output,
 
1471
                              transport=transport)
1453
1472
            if result:
1454
1473
                bzrlib.trace.info('tests passed')
1455
1474
            else: