Esempio n. 1
0
    def test_available_packages_missed_attr(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1, check_items=False)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__', new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertFalse(packages)
Esempio n. 2
0
    def test_available_packages_valid_files(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__', new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertEqual(len(packages), 1)
        self.assertTrue(FAKE_NAME1 in packages)
Esempio n. 3
0
    def test_available_packages_invalid_files(self):
        filenames = [
            '__ini__.py',
            'module.pyc',
        ]

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            packages = get_available_packages()

        self.assertFalse(packages)
Esempio n. 4
0
    def test_available_packages_invalid_files(self):
        filenames = [
            '__ini__.py',
            'module.pyc',
        ]

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            packages = get_available_packages()

        self.assertFalse(packages)
Esempio n. 5
0
    def test_available_packages_missed_attr(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1,
                                                         check_items=False)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__',
                       new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertFalse(packages)
Esempio n. 6
0
    def test_available_packages_valid_files(self):
        filenames, import_mock = self.create_fake_import(name=FAKE_NAME1)

        with patch('procyon.pkg.logic.os.listdir', new=lambda ls: filenames):
            with patch('__builtin__.__import__',
                       new=lambda *args: import_mock):
                packages = get_available_packages()

        self.assertEqual(len(packages), 1)
        self.assertTrue(FAKE_NAME1 in packages)
Esempio n. 7
0
def cache():
    """Output all available to install packages.
    """
    return get_available_packages()
Esempio n. 8
0
    def test_available_packages_type(self):
        packages = get_available_packages()

        self.assertEqual(type(packages), type({}))
Esempio n. 9
0
File: core.py Progetto: Gr1N/procyon
def cache():
    """Output all available to install packages.
    """
    return get_available_packages()
Esempio n. 10
0
    def test_available_packages_type(self):
        packages = get_available_packages()

        self.assertEqual(type(packages), type({}))