mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #17177: Stop using imp in a bunch of tests
This commit is contained in:
parent
8a2a902f88
commit
9529fbfd36
7 changed files with 17 additions and 15 deletions
|
@ -1,12 +1,12 @@
|
|||
from test.support import run_unittest, unload, check_warnings
|
||||
import unittest
|
||||
import sys
|
||||
import imp
|
||||
import importlib
|
||||
import pkgutil
|
||||
import os
|
||||
import os.path
|
||||
import tempfile
|
||||
import types
|
||||
import shutil
|
||||
import zipfile
|
||||
|
||||
|
@ -105,7 +105,7 @@ class PkgutilPEP302Tests(unittest.TestCase):
|
|||
class MyTestLoader(object):
|
||||
def load_module(self, fullname):
|
||||
# Create an empty module
|
||||
mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
|
||||
mod = sys.modules.setdefault(fullname, types.ModuleType(fullname))
|
||||
mod.__file__ = "<%s>" % self.__class__.__name__
|
||||
mod.__loader__ = self
|
||||
# Make it a package
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue