def temp_fn_02(): module_output_file_name = _create_temp_file_name() exception_caught = False try: checksum_dependency_helper = ChecksumDependencyHelper( determine_file_path_fn=helper.determine_file_path, determine_checksums_from_file_path_fn=helper. determine_checksums_from_file_path_throw_exception) build_info_module_generator = BuildInfoModuleGenerator( determine_dependency_checksums_fn=checksum_dependency_helper) ######################################## #Invoke functionality being tested build_info_module_generator.update( module_id=helper.module_id, module_properties=helper.module_properties, freeze_file=helper.full_requirements_file, dist_files=[ ('sdist', None, helper.sdist_file), # ('bdist', None, bdist_file), ('bdist_egg', None, helper.egg_file) ], module_file=module_output_file_name, force_dependency_rebuild=False, force_clean=False) except HTTPError: exception_caught = True #Make sure no trash module file is left behind assert not os.path.exists(module_output_file_name) assert exception_caught, "Expect HTTPError to be encountered"
def _execute(module_id, dist_files_tuple_array, freeze_file, module_file, force_dependency_rebuild, force_clean, expected_module_properties, expected_artifacts, expected_dependencies): #tuple pattern is: (command, python_version, dist_file) checksum_dependency_helper = ChecksumDependencyHelper( determine_file_path_fn=helper.determine_file_path, determine_checksums_from_file_path_fn=helper. determine_checksums_from_file_path) build_info_module_generator = BuildInfoModuleGenerator( determine_dependency_checksums_fn=checksum_dependency_helper) ######################################## #Invoke functionality being tested build_info_module_generator.update( module_id=module_id, module_properties=helper.module_properties, freeze_file=freeze_file, dist_files=dist_files_tuple_array, module_file=module_file, force_dependency_rebuild=force_dependency_rebuild, force_clean=force_clean) ######################################## #validate behavior module = _read_module_file(module_file) eq_(module.id, module_id) eq_(module.artifacts, expected_artifacts) eq_(module.dependencies, expected_dependencies) eq_(module.properties, expected_module_properties)
def temp_fn_02(): module_output_file_name = _create_temp_file_name() exception_caught = False try: checksum_dependency_helper = ChecksumDependencyHelper( determine_file_path_fn=helper.determine_file_path, determine_checksums_from_file_path_fn= helper.determine_checksums_from_file_path_throw_exception) build_info_module_generator = BuildInfoModuleGenerator( determine_dependency_checksums_fn=checksum_dependency_helper) ######################################## #Invoke functionality being tested build_info_module_generator.update( module_id=helper.module_id, module_properties=helper.module_properties, freeze_file=helper.full_requirements_file, dist_files=[ ('sdist', None, helper.sdist_file), # ('bdist', None, bdist_file), ('bdist_egg', None, helper.egg_file)], module_file=module_output_file_name, force_dependency_rebuild=False, force_clean=False) except HTTPError: exception_caught = True #Make sure no trash module file is left behind assert not os.path.exists(module_output_file_name) assert exception_caught, "Expect HTTPError to be encountered"
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 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 _execute( module_id, dist_files_tuple_array, freeze_file, module_file, force_dependency_rebuild, force_clean, expected_module_properties, expected_artifacts, expected_dependencies): #tuple pattern is: (command, python_version, dist_file) checksum_dependency_helper = ChecksumDependencyHelper( determine_file_path_fn=helper.determine_file_path, determine_checksums_from_file_path_fn= helper.determine_checksums_from_file_path) build_info_module_generator = BuildInfoModuleGenerator( determine_dependency_checksums_fn=checksum_dependency_helper) ######################################## #Invoke functionality being tested build_info_module_generator.update( module_id=module_id, module_properties=helper.module_properties, freeze_file=freeze_file, dist_files=dist_files_tuple_array, module_file=module_file, force_dependency_rebuild=force_dependency_rebuild, force_clean=force_clean) ######################################## #validate behavior module = _read_module_file(module_file) eq_(module.id, module_id) eq_(module.artifacts, expected_artifacts) eq_(module.dependencies, expected_dependencies) eq_(module.properties, expected_module_properties)