From 0fde72b2f55f875ffc67a6b26e402d433b1e0c98 Mon Sep 17 00:00:00 2001 From: Crozzers Date: Sun, 30 Apr 2023 12:19:45 +0100 Subject: [PATCH 1/2] Remove deprecated imp module --- test/testlib.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/testlib.py b/test/testlib.py index 2c345573..c6244dc4 100644 --- a/test/testlib.py +++ b/test/testlib.py @@ -54,14 +54,14 @@ import os -from os.path import join, basename, dirname, abspath, splitext, \ +from os.path import join, basename, abspath, splitext, \ isfile, isdir, normpath, exists import sys import getopt import glob import time import unittest -import imp +import importlib import logging import textwrap import traceback @@ -234,13 +234,12 @@ def testmods_from_testdir(testdir): testmod_name = splitext(basename(testmod_path))[0] log.debug("import test module '%s'", testmod_path) try: - iinfo = imp.find_module(testmod_name, [dirname(testmod_path)]) testabsdir = abspath(testdir) sys.path.insert(0, testabsdir) old_dir = os.getcwd() os.chdir(testdir) try: - testmod = imp.load_module(testmod_name, *iinfo) + testmod = importlib.import_module(testmod_name) finally: os.chdir(old_dir) sys.path.remove(testabsdir) From 50a9f171cbe22758b5940e8ed290cd5afda4536c Mon Sep 17 00:00:00 2001 From: Crozzers Date: Sun, 30 Apr 2023 12:21:52 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index c6b1df5e..70518201 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ - [pull #502] Replace deprecated `optparse` with `argparse` - [pull #506] Fix `_uniform_outdent` failing with empty strings (issue #505) - [pull #509] Fix HTML elements not unhashing correctly (issue 508) +- [pull #511] Remove deprecated `imp` module (issue #510) ## python-markdown2 2.4.8