mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #15576: Allow extension modules to be a package's __init__
module again. Also took the opportunity to stop accidentally exporting _imp.extension_suffixes() as public.
This commit is contained in:
parent
f4dc9204cc
commit
ac9f2f3de3
13 changed files with 3700 additions and 3688 deletions
|
|
@ -3,6 +3,7 @@ from . import util as ext_util
|
|||
from .. import abc
|
||||
from .. import util
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
|
|
@ -38,11 +39,11 @@ class LoaderTests(abc.LoaderTests):
|
|||
machinery.ExtensionFileLoader)
|
||||
|
||||
def test_package(self):
|
||||
# Extensions are not found in packages.
|
||||
# No extension module as __init__ available for testing.
|
||||
pass
|
||||
|
||||
def test_lacking_parent(self):
|
||||
# Extensions are not found in packages.
|
||||
# No extension module in a package available for testing.
|
||||
pass
|
||||
|
||||
def test_module_reuse(self):
|
||||
|
|
@ -61,6 +62,13 @@ class LoaderTests(abc.LoaderTests):
|
|||
self.load_module(name)
|
||||
self.assertEqual(cm.exception.name, name)
|
||||
|
||||
def test_is_package(self):
|
||||
self.assertFalse(self.loader.is_package(ext_util.NAME))
|
||||
for suffix in machinery.EXTENSION_SUFFIXES:
|
||||
path = os.path.join('some', 'path', 'pkg', '__init__' + suffix)
|
||||
loader = machinery.ExtensionFileLoader('pkg', path)
|
||||
self.assertTrue(loader.is_package('pkg'))
|
||||
|
||||
|
||||
def test_main():
|
||||
from test.support import run_unittest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue