Exemple #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)
Exemple #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)
Exemple #3
0
def test_safestr():
    from metrique.utils import safestr
    str_ = '     abc123:;"/\\.,\n\t'
    assert safestr(str_) == 'abc123'
    assert safestr(None) == ''
Exemple #4
0
def test_safestr():
    from metrique.utils import safestr
    str_ = '     abc123:;"/\\.,\n\t'
    assert safestr(str_) == 'abc123'
    assert safestr(None) == ''