當前位置: 首頁>>代碼示例>>Python>>正文


Python Depends.list_all_packages方法代碼示例

本文整理匯總了Python中bindep.depends.Depends.list_all_packages方法的典型用法代碼示例。如果您正苦於以下問題:Python Depends.list_all_packages方法的具體用法?Python Depends.list_all_packages怎麽用?Python Depends.list_all_packages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bindep.depends.Depends的用法示例。


在下文中一共展示了Depends.list_all_packages方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_list_all

# 需要導入模塊: from bindep.depends import Depends [as 別名]
# 或者: from bindep.depends.Depends import list_all_packages [as 別名]
    def test_list_all(self):
        depends = Depends(dedent("""\
            install1
            install2 [test]
            install3 [platform:rpm]
            install4 [platform:dpkg]
            install5 [quark]
            install6 [platform:dpkg test]
            install7 [quark test]
            install8 [platform:dpkg platform:rpm]
            install9 [platform:dpkg platform:rpm test]
            installA [!platform:dpkg]
            installB [!platform:dpkg test]
            installC [!platform:dpkg !test]
            installD [platform:dpkg !test]
            installE [platform:dpkg !platform:rpm]
            installF [platform:dpkg !platform:rpm test]
            installG [!platform:dpkg !platform:rpm]
            installH [!platform:dpkg !platform:rpm test]
            installI [!platform:dpkg !platform:rpm !test]
            installJ [platform:dpkg !platform:rpm !test]
            """))

        rules_dpkg = depends.active_rules(['platform:dpkg'])
        result_dpkg = set(r[0] for r in rules_dpkg)
        self.assertEqual(result_dpkg,
                         set(depends.list_all_packages(rules_dpkg,
                             output_format='newline')))
        self.assertEqual(result_dpkg,
                         set(depends.list_all_packages(rules_dpkg,
                             output_format='csv')))

        rules_dpkg_test = depends.active_rules(['platform:dpkg', 'test'])
        result_dpkg_test = set(r[0] for r in rules_dpkg_test)
        self.assertEqual(result_dpkg_test, set(depends.list_all_packages(
                                               rules_dpkg_test,
                                               output_format='newline')))
        self.assertEqual(result_dpkg_test, set(depends.list_all_packages(
                                               rules_dpkg_test,
                                               output_format='csv')))

        rules_rpm = depends.active_rules(['platform:rpm'])
        result_rpm = set(r[0] for r in rules_rpm)
        self.assertEqual(result_rpm, set(depends.list_all_packages(rules_rpm,
                                         output_format='newline')))
        self.assertEqual(result_rpm, set(depends.list_all_packages(rules_rpm,
                                         output_format='csv')))

        rules_rpm_test = depends.active_rules(['platform:rpm', 'test'])
        result_rpm_test = set(r[0] for r in rules_rpm_test)
        self.assertEqual(result_rpm_test,
                         set(depends.list_all_packages(
                             rules_rpm_test,
                             output_format='newline')))
        self.assertEqual(result_rpm_test,
                         set(depends.list_all_packages(
                             rules_rpm_test,
                             output_format='csv')))
開發者ID:openstack-infra,項目名稱:bindep,代碼行數:60,代碼來源:test_depends.py


注:本文中的bindep.depends.Depends.list_all_packages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。