_compat.py 708 B

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. try:
  3. from test.support import import_helper # type: ignore
  4. except ImportError:
  5. # Python 3.9 and earlier
  6. class import_helper: # type: ignore
  7. from test.support import (
  8. modules_setup,
  9. modules_cleanup,
  10. DirsOnSysPath,
  11. CleanImport,
  12. )
  13. try:
  14. from test.support import os_helper # type: ignore
  15. except ImportError:
  16. # Python 3.9 compat
  17. class os_helper: # type:ignore
  18. from test.support import temp_dir
  19. try:
  20. # Python 3.10
  21. from test.support.os_helper import unlink
  22. except ImportError:
  23. from test.support import unlink as _unlink
  24. def unlink(target):
  25. return _unlink(os.fspath(target))