Exemple #1
0
def test_get_diff_svn(svn_source_repo: Tuple[str, str, str]):
    """Test get_diff() for an svn working copy"""
    source_dir, uuid, repo_path = svn_source_repo
    diff = get_diff('svn', source_dir)
    assert diff is not None
    diff_lines = diff.splitlines()
    for line in ("--- flow.cylc	(revision 1)", "+++ flow.cylc	(working copy)",
                 "-        R1 = foo", "+        R1 = bar"):
        assert line in diff_lines
Exemple #2
0
def test_get_diff_git(git_source_repo: Tuple[str, str]):
    """Test get_diff() for a git repo"""
    source_dir, commit_sha = git_source_repo
    diff = get_diff('git', source_dir)
    assert diff is not None
    diff_lines = diff.splitlines()
    for line in ("diff --git a/flow.cylc b/flow.cylc", "-        R1 = foo",
                 "+        R1 = bar"):
        assert line in diff_lines
Exemple #3
0
def test_no_base_commit_git(tmp_path: Path):
    """Test get_vc_info() and get_diff() for a recently init'd git source dir
    that does not have a base commit yet."""
    source_dir = Path(tmp_path, 'new_git_repo')
    source_dir.mkdir()
    subprocess.run(['git', 'init'], cwd=source_dir, check=True)
    flow_file = source_dir.joinpath('flow.cylc')
    flow_file.write_text(BASIC_FLOW_1)

    vc_info = get_vc_info(source_dir)
    assert vc_info is not None
    expected = [('version control system', "git"),
                ('working copy root path', str(source_dir)),
                ('status', "?? flow.cylc")]
    assert list(vc_info.items()) == expected
    assert get_diff('git', source_dir) is None