Exemplo n.º 1
0
def test_git_clone():
    # FIXME: THIS ONE IS CAUSING SOME INTERESTING PROBLEMS?
    from metrique.utils import git_clone, safestr, remove_file
    uri = 'https://github.com/kejbaly2/tornadohttp.git'
    local_path = os.path.join(cache_dir, safestr(uri))
    remove_file(local_path, force=True)

    _t = time()
    repo = git_clone(uri, pull=False, reflect=False, cache_dir=cache_dir)
    assert repo == local_path
    not_cached = time() - _t

    _t = time()
    repo = git_clone(uri, pull=False, reflect=True, cache_dir=cache_dir)
    cached = time() - _t

    assert repo.path == local_path
    assert cached < not_cached

    git_clone(uri, pull=True, reflect=False, cache_dir=cache_dir)
    remove_file(local_path, force=True)
Exemplo n.º 2
0
def test_git_clone():
    # FIXME: THIS ONE IS CAUSING SOME INTERESTING PROBLEMS?
    from metrique.utils import git_clone, safestr, remove_file
    uri = 'https://github.com/kejbaly2/tornadohttp.git'
    local_path = os.path.join(cache_dir, safestr(uri))
    remove_file(local_path, force=True)

    _t = time()
    repo = git_clone(uri, pull=False, reflect=False, cache_dir=cache_dir)
    assert repo == local_path
    not_cached = time() - _t

    _t = time()
    repo = git_clone(uri, pull=False, reflect=True, cache_dir=cache_dir)
    cached = time() - _t

    assert repo.path == local_path
    assert cached < not_cached

    git_clone(uri, pull=True, reflect=False, cache_dir=cache_dir)
    remove_file(local_path, force=True)
Exemplo n.º 3
0
def test_safestr():
    from metrique.utils import safestr
    str_ = '     abc123:;"/\\.,\n\t'
    assert safestr(str_) == 'abc123'
    assert safestr(None) == ''
Exemplo n.º 4
0
def test_safestr():
    from metrique.utils import safestr
    str_ = '     abc123:;"/\\.,\n\t'
    assert safestr(str_) == 'abc123'
    assert safestr(None) == ''