Staging
v0.5.2
https://github.com/python/cpython
Raw File
Tip revision: 1b94ab79a95ba69e017348ffeb04ef52616a4540 authored by Georg Brandl on 11 August 2012, 06:49:20 UTC
Bump to 3.3b2.
Tip revision: 1b94ab7
test_finder.py
from importlib import machinery
from .. import abc
from .. import util
from . import util as builtin_util

import sys
import unittest

class FinderTests(abc.FinderTests):

    """Test find_module() for built-in modules."""

    def test_module(self):
        # Common case.
        with util.uncache(builtin_util.NAME):
            found = machinery.BuiltinImporter.find_module(builtin_util.NAME)
            self.assertTrue(found)

    def test_package(self):
        # Built-in modules cannot be a package.
        pass

    def test_module_in_package(self):
        # Built-in modules cannobt be in a package.
        pass

    def test_package_in_package(self):
        # Built-in modules cannot be a package.
        pass

    def test_package_over_module(self):
        # Built-in modules cannot be a package.
        pass

    def test_failure(self):
        assert 'importlib' not in sys.builtin_module_names
        loader = machinery.BuiltinImporter.find_module('importlib')
        self.assertIsNone(loader)

    def test_ignore_path(self):
        # The value for 'path' should always trigger a failed import.
        with util.uncache(builtin_util.NAME):
            loader = machinery.BuiltinImporter.find_module(builtin_util.NAME,
                                                            ['pkg'])
            self.assertIsNone(loader)



def test_main():
    from test.support import run_unittest
    run_unittest(FinderTests)


if __name__ == '__main__':
    test_main()
back to top