/PC/testpy.py

http://unladen-swallow.googlecode.com/ · Python · 32 lines · 22 code · 6 blank · 4 comment · 5 complexity · 9991fc2e2f2cd420db09ff100e780162 MD5 · raw file

  1. import sys
  2. # This is a test module for Python. It looks in the standard
  3. # places for various *.py files. If these are moved, you must
  4. # change this module too.
  5. try:
  6. import os
  7. except:
  8. print """Could not import the standard "os" module.
  9. Please check your PYTHONPATH environment variable."""
  10. sys.exit(1)
  11. try:
  12. import symbol
  13. except:
  14. print """Could not import the standard "symbol" module. If this is
  15. a PC, you should add the dos_8x3 directory to your PYTHONPATH."""
  16. sys.exit(1)
  17. import os
  18. for dir in sys.path:
  19. file = os.path.join(dir, "os.py")
  20. if os.path.isfile(file):
  21. test = os.path.join(dir, "test")
  22. if os.path.isdir(test):
  23. # Add the "test" directory to PYTHONPATH.
  24. sys.path = sys.path + [test]
  25. import regrtest # Standard Python tester.
  26. regrtest.main()