Пример #1
0
def test_externals(name, externals, expectations):

    with patch("dfetch.project.svn.run_on_cmdline") as run_on_cmdline_mock:
        with patch("dfetch.project.svn.SvnRepo._get_info_from_target"
                   ) as target_info_mock:
            with patch("dfetch.project.svn.os.getcwd") as cwd_mock:

                cmd_output = str(os.linesep * 2).join(externals)
                run_on_cmdline_mock().stdout = cmd_output.encode("utf-8")
                target_info_mock.return_value = {"Repository Root": REPO_ROOT}

                cwd_mock.return_value = CWD
                parsed_externals = SvnRepo.externals()

                for actual, expected in zip(parsed_externals, expectations):
                    assert actual == expected
Пример #2
0
def _import_from_svn() -> Sequence[ProjectEntry]:
    projects: List[ProjectEntry] = []

    for external in SvnRepo.externals():
        projects.append(
            ProjectEntry({
                "name": external.name,
                "revision": external.revision,
                "url": external.url,
                "dst": external.path,
                "branch": external.branch,
                "tag": external.tag,
                "src": external.src,
            }))
        logger.info(f"Found {external.name}")

    return projects