Author Olivier.Grisel
Recipients Olivier.Grisel, brett.cannon, eric.snow, ncoghlan, pitrou, sbt
Date 2013-12-11.08:41:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386751279.06.0.98550313741.issue19946@psf.upfronthosting.co.za>
In-reply-to
Content
> what is sys.modules['__main__'] and sys.modules['__main__'].__file__ if you run under nose?

$ cat check_stuff.py 
import sys

def test_main():
    print("sys.modules['__main__']=%r"
          % sys.modules['__main__'])
    print("sys.modules['__main__'].__file__=%r"
          % sys.modules['__main__'].__file__)


if __name__ == '__main__':
    test_main()
(pyhead) ogrisel@is146148:~/tmp$ python check_stuff.py 
sys.modules['__main__']=<module '__main__' from 'check_stuff.py'>
sys.modules['__main__'].__file__='check_stuff.py'
(pyhead) ogrisel@is146148:~/tmp$ nosetests -s check_stuff.py 
sys.modules['__main__']=<module '__main__' from '/volatile/ogrisel/envs/pyhead/bin/nosetests'>
sys.modules['__main__'].__file__='/volatile/ogrisel/envs/pyhead/bin/nosetests'
.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK
History
Date User Action Args
2013-12-11 08:41:19Olivier.Griselsetrecipients: + Olivier.Grisel, brett.cannon, ncoghlan, pitrou, sbt, eric.snow
2013-12-11 08:41:19Olivier.Griselsetmessageid: <1386751279.06.0.98550313741.issue19946@psf.upfronthosting.co.za>
2013-12-11 08:41:19Olivier.Grisellinkissue19946 messages
2013-12-11 08:41:18Olivier.Griselcreate