Esempio n. 1
0
    def test_just_comment(self):
        test_file = "# test comment"
        expected = []

        with patch('builtins.open', mock_open(read_data=test_file)):
            output = pkglist.parsePkgList("foo")
            self.assertEqual(output, expected)
Esempio n. 2
0
    def test_extra_spaces(self):
        test_file = "   pkg   \n  pkg2"
        expected = ["pkg", "pkg2"]

        with patch('builtins.open', mock_open(read_data=test_file)):
            output = pkglist.parsePkgList("foo")
            self.assertEqual(output, expected)
Esempio n. 3
0
    def test_multiple_packages_multiple_comments(self):
        test_file = "pkg # test comment\npkg2 #with another comment\n# no package, just comment"
        expected = ["pkg", "pkg2"]

        with patch('builtins.open', mock_open(read_data=test_file)):
            output = pkglist.parsePkgList("foo")
            self.assertEqual(output, expected)
Esempio n. 4
0
    def test_single_package_with_comment(self):
        test_file = "pkg # test comment"
        expected = ["pkg"]

        with patch('builtins.open', mock_open(read_data=test_file)):
            output = pkglist.parsePkgList("foo")
            self.assertEqual(output, expected)
Esempio n. 5
0
    def getPackagesByConfig(self, path):
        pkgs = {}

        for c in self.getConfigs(path):
            pkgs[c] = parsePkgList(c)

        return pkgs
Esempio n. 6
0
    def getPackages(self, path):
        pkgs = set()

        for c in self.getConfigs(path):
            pkgs = pkgs.union(set(parsePkgList(c)))

        return pkgs