the module nosetests runs everywhere on my computer (it shouldn't it should only run in a few specified places). I guess this is because i have accidentally added the module nosetests to the PYTHONPATH either by putting it directly in either the dist-packages or site-packages or telling python to look for it permanently everytime.
I'm familiar with a few commands like find, import os, import sys and PYTHONPATH but i can't seem to find a way track down the culprit directory thats allowing this to happen.
something like
>>> find . -name "*nosetests"* -print
any help would be great.
To solve your problem it's enough to examine nosetests.__file__
, as @Adam suggested. But there's a more general way: the inspect
module, which also works for classes and other objects that don't have a __file__
attribute.
import inspect, nosetests
print inspect.getsourcefile(nosetests)