enthought / envisage

Envisage is a Python-based framework for building applications whose functionalities can be extended by adding "plug-ins".
http://docs.enthought.com/envisage/
Other
82 stars 26 forks source link

Fix EggPluginManager to use current pkg_resources.working_set #444

Closed mdickinson closed 3 years ago

mdickinson commented 3 years ago

The EggPluginManager uses the following trait definition for its working set:

working_set = Instance(pkg_resources.WorkingSet, pkg_resources.working_set)

This means that we're capturing the value of pkg_resources.working_set at import time, and using that value as the default for each EggPluginManager.

For testing purposes, it's convenient to be able to use a temporary replacement working set for pkg_resources.working_set to avoid test interactions. But this currently doesn't work.

This PR changes the working_set trait so that it looks up pkg_resources.working_set on first use, on a per-EggPluginManager-instance basis, instead of doing that lookup just once at import time.

rahulporuri commented 3 years ago

We'd have slightly more flexibility (especially in testing) if we looked up pkg_resources.working_set at

The PR description seems a bit off.

mdickinson commented 3 years ago

The PR description seems a bit off.

Thanks; fixed.