view tests/run.py @ 469:5567af673f83

Revive svn+http(s) URLs support (issue94) Telling svn from mercurial repository automatically is not always possible, or at least not seamlessly. Let 'http://repo.com/svn' be an svn repository, protected with basic authentication. Trying to clone it directly does something like: 1- Open it like a mercurial repository: * send between command, ask for credentials, fail * fallback to static-http, ask for crendentials two times, fail 2- Open it like an svn repository Mercurial [auth] facility is helpful here, but few people know about it, and it may seem weird to store svn credentials in mercurial configuration. An svn-like password manager would not help either because all connections attempts in [1] fail and it's unlikely we would store credentials in this situation. Instead, we can clone 'svn+http://repo.com/svn', which will skip step [1].
author Patrick Mezard <pmezard@gmail.com>
date Sat, 18 Jul 2009 20:44:33 -0500
parents 72e63999722f
children f3e5ef8760cb
line wrap: on
line source

import os
import sys
import unittest

import test_util
import test_binaryfiles
import test_diff
import test_externals
import test_fetch_branches
import test_fetch_command
import test_fetch_command_regexes
import test_fetch_exec
import test_fetch_mappings
import test_fetch_renames
import test_fetch_symlinks
import test_fetch_truncated
import test_pull
import test_push_command
import test_push_renames
import test_push_dirs
import test_push_eol
import test_rebuildmeta
import test_svnwrap
import test_tags
import test_utility_commands
import test_urls

sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive'))

import test_stupid_pull
import test_verify

def comprehensive(mod):
    dir = os.path.basename(os.path.dirname(mod.__file__))
    return dir == 'comprehensive'

if __name__ == '__main__':

    kwargs = {'descriptions': 2}
    if '-v' in sys.argv:
        kwargs['descriptions'] = 3
        kwargs['verbosity'] = 2

    # silence output when running outside nose
    sys.stdout = os.tmpfile()

    all = globals()
    all = dict((k, v) for (k, v) in all.iteritems() if k.startswith('test_'))
    del all['test_util']

    args = [i for i in sys.argv[1:] if i.startswith('test')]
    args = [i.split('.py')[0].replace('-', '_') for i in args]

    if not args:
        check = lambda x: '-A' in sys.argv or not comprehensive(x)
        mods = [m for (n, m) in sorted(all.iteritems()) if check(m)]
        suite = [m.suite() for m in mods]
    else:
        suite = []
        for arg in args:
            if arg not in all:
                print >> sys.stderr, 'test module %s not available' % arg
            else:
                suite.append(all[arg].suite())

    runner = unittest.TextTestRunner(**kwargs)
    runner.run(unittest.TestSuite(suite))