fix tests

This commit is contained in:
Frost Ming 2022-07-21 22:21:34 +08:00
parent 1472bcc075
commit d387e3b976
No known key found for this signature in database
GPG Key ID: 5BFA9CB4DDA943BF

View File

@ -24,11 +24,14 @@ class TestActionSuite(unittest.TestCase):
python_version = ".".join(map(str, sys.version_info[:2]))
for package in PACKAGE_MAP.values():
if package != PACKAGE_MAP[python_version]:
try:
print(importlib.import_module(package))
except ImportError:
pass
self.assertRaises(
ModuleNotFoundError,
importlib.import_module,
package,
msg=f"Package {package} should not be installed",
)
else:
importlib.import_module(package)