Ejemplo n.º 1
0
def test_which_no_hg_found(monkeypatch):
    monkeypatch.setenv("PATH", "/")
    which('hg')
    which('hg', '/')
Ejemplo n.º 2
0
# -*- coding: utf-8 -*-
"""Tests for libvcs git repos."""
from __future__ import absolute_import, print_function, unicode_literals

import datetime
import os

import pytest

from libvcs import exc
from libvcs._compat import string_types
from libvcs.git import GitRepo
from libvcs.util import run, which
from libvcs.shortcuts import create_repo_from_pip_url

if not which('git'):
    pytestmark = pytest.mark.skip(reason="git is not available")


def test_repo_git_obtain_initial_commit_repo(tmpdir):
    """initial commit repos return 'initial'.

    note: this behaviors differently from git(1)'s use of the word "bare".
    running `git rev-parse --is-bare-repository` would return false.
    """
    repo_name = 'my_git_project'

    run(['git', 'init', repo_name], cwd=str(tmpdir))

    bare_repo_dir = tmpdir.join(repo_name)
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
"""Tests for libvcs git repos."""
from __future__ import absolute_import, print_function, unicode_literals

import datetime
import os

import pytest

from libvcs import exc
from libvcs._compat import string_types
from libvcs.git import GitRepo
from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import run, which

if not which('git'):
    pytestmark = pytest.mark.skip(reason="git is not available")


def test_repo_git_obtain_initial_commit_repo(tmpdir):
    """initial commit repos return 'initial'.

    note: this behaviors differently from git(1)'s use of the word "bare".
    running `git rev-parse --is-bare-repository` would return false.
    """
    repo_name = 'my_git_project'

    run(['git', 'init', repo_name], cwd=str(tmpdir))

    bare_repo_dir = tmpdir.join(repo_name)
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
"""Tests for libvcs hg repos."""
from __future__ import absolute_import, print_function, unicode_literals

import os

import pytest

from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import which, run

if not which('hg'):
    pytestmark = pytest.mark.skip(reason="hg is not available")


@pytest.fixture
def hg_remote(parentdir, scope='session'):
    """Create a git repo with 1 commit, used as a remote."""
    name = 'dummyrepo'
    repo_path = str(parentdir.join(name))

    run(['hg', 'init', name], cwd=str(parentdir))

    testfile_filename = 'testfile.test'

    run(['touch', testfile_filename], cwd=repo_path)
    run(['hg', 'add', testfile_filename], cwd=repo_path)
    run(['hg', 'commit', '-m', 'test file for %s' % name], cwd=repo_path)

    return repo_path
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
"""tests for libvcs svn repos."""
from __future__ import absolute_import, print_function, unicode_literals

import os

import pytest

from libvcs.util import run, which
from libvcs.shortcuts import create_repo_from_pip_url

if not which('svn'):
    pytestmark = pytest.mark.skip(reason="svn is not available")


@pytest.fixture
def svn_remote(parentdir, scope='session'):
    """Create a git repo with 1 commit, used as a remote."""
    server_dirname = 'server_dir'
    server_dir = parentdir.join(server_dirname)

    run(['svnadmin', 'create', str(server_dir)])

    return str(server_dir)


def test_repo_svn(tmpdir, svn_remote):
    repo_name = 'my_svn_project'

    svn_repo = create_repo_from_pip_url(
        **{
Ejemplo n.º 6
0
# -*- coding: utf-8 -*-
"""Tests for libvcs hg repos."""
from __future__ import absolute_import, print_function, unicode_literals

import os

import pytest

from libvcs import exc
from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import run, which

try:
    which('hg')
except exc.LibVCSException:
    pytestmark = pytest.mark.skip(reason="hg is not available")


@pytest.fixture
def hg_dummy_repo_dir(tmpdir_repoparent, scope='session'):
    """Create a git repo with 1 commit, used as a remote."""
    name = 'dummyrepo'
    repo_path = str(tmpdir_repoparent.join(name))

    run(['hg', 'init', name], cwd=str(tmpdir_repoparent))

    testfile_filename = 'testfile.test'

    run(['touch', testfile_filename],
        cwd=repo_path)
    run(['hg', 'add', testfile_filename],
Ejemplo n.º 7
0
# -*- coding: utf-8 -*-
"""tests for libvcs svn repos."""
from __future__ import absolute_import, print_function, unicode_literals

import os

import pytest

from libvcs.util import run, which
from libvcs.shortcuts import create_repo_from_pip_url

if not which('svn'):
    pytestmark = pytest.mark.skip(reason="svn is not available")


@pytest.fixture
def svn_remote(parentdir, scope='session'):
    """Create a git repo with 1 commit, used as a remote."""
    server_dirname = 'server_dir'
    server_dir = parentdir.join(server_dirname)

    run(['svnadmin', 'create', str(server_dir)])

    return str(server_dir)


def test_repo_svn(tmpdir, svn_remote):
    repo_name = 'my_svn_project'

    svn_repo = create_repo_from_pip_url(**{
        'pip_url': 'svn+file://' + svn_remote,
Ejemplo n.º 8
0
# -*- coding: utf-8 -*-
"""Tests for libvcs hg repos."""
from __future__ import absolute_import, print_function, unicode_literals

import os

import pytest

from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import run, which

if not which('hg'):
    pytestmark = pytest.mark.skip(reason="hg is not available")


@pytest.fixture
def hg_remote(parentdir, scope='session'):
    """Create a git repo with 1 commit, used as a remote."""
    name = 'dummyrepo'
    repo_path = str(parentdir.join(name))

    run(['hg', 'init', name], cwd=str(parentdir))

    testfile_filename = 'testfile.test'

    run(['touch', testfile_filename], cwd=repo_path)
    run(['hg', 'add', testfile_filename], cwd=repo_path)
    run(['hg', 'commit', '-m', 'test file for %s' % name], cwd=repo_path)

    return repo_path