本文整理汇总了Python中enstaller.repository.Repository.delete_package方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.delete_package方法的具体用法?Python Repository.delete_package怎么用?Python Repository.delete_package使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enstaller.repository.Repository
的用法示例。
在下文中一共展示了Repository.delete_package方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_non_existing
# 需要导入模块: from enstaller.repository import Repository [as 别名]
# 或者: from enstaller.repository.Repository import delete_package [as 别名]
def test_delete_non_existing(self):
# Given
path = os.path.join(_EGGINST_COMMON_DATA, "nose-1.3.0-1.egg")
to_remove = PackageMetadata.from_egg(path)
repository = Repository()
# When/Then
with self.assertRaises(NoSuchPackage):
repository.delete_package(to_remove)
示例2: test_delete_simple
# 需要导入模块: from enstaller.repository import Repository [as 别名]
# 或者: from enstaller.repository.Repository import delete_package [as 别名]
def test_delete_simple(self):
# Given
eggs = ["flake8-2.0.0-2.egg", "nose-1.3.0-1.egg", "nose-1.2.1-1.egg"]
repository = Repository()
for egg in eggs:
path = os.path.join(_EGGINST_COMMON_DATA, egg)
package = RepositoryPackageMetadata.from_egg(path)
repository.add_package(package)
path = os.path.join(_EGGINST_COMMON_DATA, "nose-1.3.0-1.egg")
to_remove = PackageMetadata.from_egg(path)
# When
repository.delete_package(to_remove)
# Then
assertCountEqual(self, [p.key for p in repository.iter_packages()],
["flake8-2.0.0-2.egg", "nose-1.2.1-1.egg"])