Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MNT] address deprecation of
load_module
(#190)
`load_module` is deprecated and will be replaced by `exec_module` in python 3.12, this PR addresses that. The fix is highly nontrivial - the crucial line was `imported_mod = module.load_module()` for a `module: SourceFileLoader`, which had to be replaced by the equivalent four (!) lines ```python spec = importlib.util.spec_from_file_location(module.name, module.path) imported_mod = importlib.util.module_from_spec(spec) # these two are also crucial due to the side effects loader = spec.loader loader.exec_module(imported_mod) ``` The deprecation message raised by `load_module` is highly unhelpful, and I had to reverse engineer this from a very helpful PR in `nox`, wntrblm/nox#498
- Loading branch information