We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f9b88a commit bbb9e5cCopy full SHA for bbb9e5c
pytest-shutil/pytest_shutil/run.py
@@ -3,7 +3,7 @@
3
"""
4
import sys
5
import os
6
-import imp
+import importlib.util
7
import logging
8
from functools import update_wrapper
9
import inspect
@@ -112,7 +112,10 @@ def run_module_as_main(module, argv=[]):
112
filename = os.path.splitext(filename)[0] + ".py"
113
114
with patch("sys.argv", new=argv):
115
- imp.load_source('__main__', os.path.join(where, filename))
+ spec = importlib.util.spec_from_file_location(
116
+ "__main__", os.path.join(where, filename))
117
+ module = importlib.util.module_from_spec(spec)
118
+ spec.loader.exec_module(module)
119
120
121
def _evaluate_fn_source(src, *args, **kwargs):
0 commit comments