Exemple #1
0
def test_git_init_no_args():
    previous_working_path = os.getcwd()
    temp_dir = tempfile.mkdtemp()
    git_dir = os.path.join(temp_dir, ".git")
    os.chdir(temp_dir)
    output = git.git_init()
    os.chdir(previous_working_path)
    assert os.path.isdir(git_dir), "The {} directory wasn't created".format(
        git_dir)
    assert output is not None, "The git init command output was empty"
    shutil.rmtree(temp_dir)
Exemple #2
0
def test_git_init_separate_git_dir():
    previous_working_path = os.getcwd()
    temp_dir = tempfile.mkdtemp()
    separate_dir = os.path.join(temp_dir, "separate_dir")
    init_dir = os.path.join(temp_dir, "init_dir")
    git_file = os.path.join(init_dir, ".git")
    os.mkdir(init_dir)
    os.chdir(init_dir)
    output = git.git_init(separate_git_dir=separate_dir)
    os.chdir(previous_working_path)
    assert os.path.isdir(separate_dir), "The {} directory wasn't created".format(
        separate_dir)
    assert os.path.isfile(git_file), "The {} file wasn't created".format(
        git_file)
    assert output is not None, "The git init command output was empty"
    shutil.rmtree(temp_dir)
Exemple #3
0
def test_git_init_template_dir():
    previous_working_path = os.getcwd()
    temp_dir = tempfile.mkdtemp()
    template_dir = os.path.join(temp_dir, "template_dir")
    os.mkdir(template_dir)
    description_file = os.path.join(template_dir, "description")
    with io.open(description_file, "wt") as description:
        description.write(u"My description file\n")
    init_dir = os.path.join(temp_dir, "init_dir")
    git_dir = os.path.join(init_dir, ".git")
    description_file_copy = os.path.join(git_dir, "description")
    os.mkdir(init_dir)
    os.chdir(init_dir)
    output = git.git_init(template_dir=template_dir)
    os.chdir(previous_working_path)
    assert os.path.isdir(git_dir), "The {} directory wasn't created".format(
        git_dir)
    assert os.path.isfile(description_file_copy), "The {} file wasn't created".format(
        description_file_copy)
    assert output is not None, "The git init command output was empty"
    shutil.rmtree(temp_dir)
Exemple #4
0
def create_init_dir(temp_dir):
    init_dir = os.path.join(temp_dir, "init_dir")
    git.git_init(directory=init_dir)
    return init_dir