nose icon indicating copy to clipboard operation
nose copied to clipboard

Replace uses of imp.find_module / imp.load_module with importlib in the importer

Open Julian opened this issue 13 years ago • 4 comments

As of 3.3, these functions are deprecated in favor of importlib implementations, which also happen to properly respect path hooks.

This is interfering with a thing I'm writing, so if I get a moment hopefully a pull request will be incoming (without breaking backwards compat obviously).

Julian avatar Sep 27 '12 03:09 Julian

Bumping this, as this is the only warning in my project when running in python -Wd mode under python 3.6.3.

Warning looks like this:

lib/python3.6/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  from imp import find_module, load_module, acquire_lock, release_lock

wli avatar Jan 22 '18 02:01 wli

I am currently working on this. Luckily find_module() and load_module() have a replacement. acquire_lock() and release_lock() however don't. We could use threading instead?

Michael-E-Rose avatar Dec 13 '18 12:12 Michael-E-Rose

Has there been any progress on this? Do we still need the acquire_lock calls given importlib does locking internally? If the locks are just being used to guard local state, then using the threading module seems like the better strategy.

snstanton avatar Apr 08 '19 20:04 snstanton

This has been fixed in https://github.com/mdmintz/pynose/releases/tag/v1.4.3 using the code from @chugcup (https://github.com/chugcup/nose/commit/67654c89b17a302763f57feea0abc4fba3ad2322).

pynose in the new maintained nose.

https://github.com/mdmintz/pynose --- https://pypi.org/project/pynose/

mdmintz avatar May 02 '23 18:05 mdmintz