mirror of
https://github.com/python/cpython.git
synced 2025-11-29 14:31:30 +00:00
Merge testing ABCs for importlib into importlib.test.abc.
This commit is contained in:
parent
b18b936e79
commit
f254a75176
6 changed files with 45 additions and 47 deletions
|
|
@ -2,6 +2,43 @@ import abc
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
class FinderTests(unittest.TestCase, metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
|
"""Basic tests for a finder to pass."""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def test_module(self):
|
||||||
|
# Test importing a top-level module.
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def test_package(self):
|
||||||
|
# Test importing a package.
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def test_module_in_package(self):
|
||||||
|
# Test importing a module contained within a package.
|
||||||
|
# A value for 'path' should be used if for a meta_path finder.
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def test_package_in_package(self):
|
||||||
|
# Test importing a subpackage.
|
||||||
|
# A value for 'path' should be used if for a meta_path finder.
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def test_package_over_module(self):
|
||||||
|
# Test that packages are chosen over modules.
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def test_failure(self):
|
||||||
|
# Test trying to find a module that cannot be handled.
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LoaderTests(unittest.TestCase, metaclass=abc.ABCMeta):
|
class LoaderTests(unittest.TestCase, metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
from importlib import machinery
|
from importlib import machinery
|
||||||
from .. import finder_tests
|
from .. import abc
|
||||||
from .. import support
|
from .. import support
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
class FinderTests(finder_tests.FinderTests):
|
class FinderTests(abc.FinderTests):
|
||||||
|
|
||||||
"""Test find_module() for built-in modules."""
|
"""Test find_module() for built-in modules."""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import importlib
|
import importlib
|
||||||
from .. import finder_tests
|
from .. import abc
|
||||||
from . import test_path_hook
|
from . import test_path_hook
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
class FinderTests(finder_tests.FinderTests):
|
class FinderTests(abc.FinderTests):
|
||||||
|
|
||||||
"""Test the finder for extension modules."""
|
"""Test the finder for extension modules."""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
import abc
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
|
|
||||||
class FinderTests(unittest.TestCase, metaclass=abc.ABCMeta):
|
|
||||||
|
|
||||||
"""Basic tests for a finder to pass."""
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def test_module(self):
|
|
||||||
# Test importing a top-level module.
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def test_package(self):
|
|
||||||
# Test importing a package.
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def test_module_in_package(self):
|
|
||||||
# Test importing a module contained within a package.
|
|
||||||
# A value for 'path' should be used if for a meta_path finder.
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def test_package_in_package(self):
|
|
||||||
# Test importing a subpackage.
|
|
||||||
# A value for 'path' should be used if for a meta_path finder.
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def test_package_over_module(self):
|
|
||||||
# Test that packages are chosen over modules.
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def test_failure(self):
|
|
||||||
# Test trying to find a module that cannot be handled.
|
|
||||||
pass
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
from ... import machinery
|
from ... import machinery
|
||||||
from .. import finder_tests
|
from .. import abc
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
class FinderTests(finder_tests.FinderTests):
|
class FinderTests(abc.FinderTests):
|
||||||
|
|
||||||
"""Test finding frozen modules."""
|
"""Test finding frozen modules."""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import importlib
|
import importlib
|
||||||
from .. import finder_tests
|
from .. import abc
|
||||||
from .. import support
|
from .. import support
|
||||||
import os
|
import os
|
||||||
import py_compile
|
import py_compile
|
||||||
|
|
@ -7,7 +7,7 @@ import unittest
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
class FinderTests(finder_tests.FinderTests):
|
class FinderTests(abc.FinderTests):
|
||||||
|
|
||||||
"""For a top-level module, it should just be found directly in the
|
"""For a top-level module, it should just be found directly in the
|
||||||
directory being searched. This is true for a directory with source
|
directory being searched. This is true for a directory with source
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue