Exemplo n.º 1
0
def test_available_package_and_version():
    ################
    #Assemble test fixtures
    finder = PipPackagePathFinder()

    ############
    #Execute unit under test
    observed_file_path = finder.determine_file_path(pkg_name="nose",
                                                    pkg_version="1.2.1")

    ###########
    #Assert results
    match_regex = r"{}/nose/nose.*1\.2\.1.*".format(PYTHON_GROUP_ID)
    path_as_expected = re.match(match_regex, observed_file_path)

    assert path_as_expected, \
        "match_regex: {} should match observed_file_path: {}".format(
            match_regex, observed_file_path)
def test_available_package_and_version():
    ################
    #Assemble test fixtures
    finder = PipPackagePathFinder()

    ############
    #Execute unit under test
    observed_file_path = finder.determine_file_path(
        pkg_name="nose",
        pkg_version="1.2.1")

    ###########
    #Assert results
    match_regex = r"{}/nose/nose.*1\.2\.1.*".format(PYTHON_GROUP_ID)
    path_as_expected = re.match(match_regex, observed_file_path)

    assert path_as_expected, \
        "match_regex: {} should match observed_file_path: {}".format(
            match_regex, observed_file_path)
Exemplo n.º 3
0
    def run(self):
        module_id = self._determine_module_id()
        self.announce(
            'Creating module_info file for module: {}'.format(module_id),
            level=log.INFO)

        # This command is never used interactively, so it doesn't make
        # sense to add support for passing in repo details like the
        # artifactory_upload command does. If that changes in the future
        # this command can always be enhanced at that time. The work
        # involved to add the options isn't so much in the code changes
        # to this command as in the test coverage that would need to be
        # written. It would also probably require refactoring the
        # commands to share a common base class. All this currently
        # falls under YAGNI (You're Not Going To Need It).

        verify_cert = not self.no_cert_verify
        repo_details = read_options()

        pip_package_path_finder = PipPackagePathFinder()

        def determine_checksums(file_path):
            return artifactory_rest.determine_checksums(
                username=repo_details.username,
                password=repo_details.password,
                repo_pull_id=repo_details.repo_pull_id,
                repo_base_url=repo_details.repo_base_url,
                file_path=file_path,
                verify_cert=verify_cert)

        checksum_dependency_helper = ChecksumDependencyHelper(
            determine_file_path_fn=pip_package_path_finder.determine_file_path,
            determine_checksums_from_file_path_fn=determine_checksums)

        build_info_module_generator = BuildInfoModuleGenerator(
            determine_dependency_checksums_fn=checksum_dependency_helper)

        requirements_file = compute_requirements_filename_full_path(
            artifact_id=module_id.artifact_id, version=module_id.version)

        module_info_file = compute_module_info_filename_full_path(
            artifact_id=module_id.artifact_id, version=module_id.version)

        build_info_module_generator.update(
            module_id=module_id,
            module_properties={},
            freeze_file=requirements_file,
            dist_files=self.distribution.dist_files,
            module_file=module_info_file,
            force_dependency_rebuild=bool(self.force_dependency_rebuild),
            force_clean=bool(self.force_clean))

        self.announce(
            'Module info file created at: {}'.format(module_info_file),
            level=log.INFO)
def test_unavailable_package():
    finder = PipPackagePathFinder()
    finder.determine_file_path(
        pkg_name="non-existent-pkg-1234",
        pkg_version="1.2.1")
def test_unavailable_version():
    finder = PipPackagePathFinder()
    finder.determine_file_path(pkg_name="nose", pkg_version="999.999.999")
Exemplo n.º 6
0
def test_unavailable_package():
    finder = PipPackagePathFinder()
    finder.determine_file_path(pkg_name="non-existent-pkg-1234",
                               pkg_version="1.2.1")
Exemplo n.º 7
0
def test_unavailable_version():
    finder = PipPackagePathFinder()
    finder.determine_file_path(pkg_name="nose", pkg_version="999.999.999")