JacobCallahan / plinko

Third party feature coverage for test frameworks
MIT License
4 stars 4 forks source link

Packages installed with `pip install -e` are considered to be part of stdlib #5

Open mirekdlugosz opened 4 years ago

mirekdlugosz commented 4 years ago

While running #4 I noticed that entry:

^[[36m[D 191114 23:42:45 python_importer:104]^[[39m Trying to import module client
^[[36m[D 191114 23:42:45 python_importer:109]^[[39m true import 1 nailgun
^[[36m[D 191114 23:42:45 python_importer:116]^[[39m true import 2 nailgun.client
^[[36m[D 191114 23:42:45 python_importer:122]^[[39m Attempting to import nailgun.client
^[[36m[D 191114 23:42:45 python_importer:128]^[[39m mod spec 1 ModuleSpec(name='nailgun.client', loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f98a5a4da10>, origin='/home/mzalewsk/sources/nailgun/nailgun/client.py')
^[[36m[D 191114 23:42:45 python_importer:148]^[[39m mod spec origin 1 /home/mzalewsk/sources/nailgun/nailgun/client.py
^[[36m[D 191114 23:42:45 python_importer:180]^[[39m client is part of the python library. skipping
^[[36m[D 191114 23:42:45 python_importer:181]^[[39m stdlib!

plinko/deep/parsers/python_importer.py::ImportManager.resolve_import() seems to differentiate "standard library" and "user installed" based on whether package originates from "site-packages" directory. This assumption will not be true for packages installed with pip install -e. And we can expect developers to use pip install -e, if only to ensure that they are running plinko against newest version of their tool.

I don't consider this to be a high priority, but submitting here so we don't forget about this.

JacobCallahan commented 4 years ago

@mirekdlugosz great find! I'll think about that some more, as there has to be some other way to determine what is in the stdlib. Worse case, we can remove this check and just let the import fail to depth limit.