test_environment.py 632 B

12345678910111213141516171819202122232425
  1. import sys
  2. REQUIRED_PYTHON = "python3"
  3. def main():
  4. system_major = sys.version_info.major
  5. if REQUIRED_PYTHON == "python":
  6. required_major = 2
  7. elif REQUIRED_PYTHON == "python3":
  8. required_major = 3
  9. else:
  10. raise ValueError("Unrecognized python interpreter: {}".format(
  11. REQUIRED_PYTHON))
  12. if system_major != required_major:
  13. raise TypeError(
  14. "This project requires Python {}. Found: Python {}".format(
  15. required_major, sys.version))
  16. else:
  17. print(">>> Development environment passes all tests!")
  18. if __name__ == '__main__':
  19. main()
Tip!

Press p or to see the previous file or, n or to see the next file