301_import1.py 429 B

12345678910111213141516171819202122232425
  1. try:
  2. import os
  3. except ImportError:
  4. exit(0)
  5. import sys
  6. is_pyc = sys.argv[0].endswith('.pyc')
  7. if is_pyc:
  8. os.chdir('tmp/tests')
  9. else:
  10. os.chdir('tests')
  11. assert os.getcwd().endswith('tests')
  12. os.environ['STDOUT'] = ''
  13. import test.a.g.q
  14. assert os.environ['STDOUT'] == 'test init!!\ntest.a init!!\ntest.a.g init!!\ntest.a.g.q init!!\n'
  15. import test
  16. assert test.__package__ == 'test'
  17. assert test.__name__ == 'test'