config.py 1.1 KB

12345678910111213141516171819202122232425262728
  1. from __future__ import annotations
  2. import os.path
  3. provided_prefix = os.getenv("MYPY_TEST_PREFIX", None)
  4. if provided_prefix:
  5. PREFIX = provided_prefix
  6. else:
  7. this_file_dir = os.path.dirname(os.path.realpath(__file__))
  8. PREFIX = os.path.dirname(os.path.dirname(this_file_dir))
  9. # Location of test data files such as test case descriptions.
  10. test_data_prefix = os.path.join(PREFIX, "test-data", "unit")
  11. package_path = os.path.join(PREFIX, "test-data", "packages")
  12. # Temp directory used for the temp files created when running test cases.
  13. # This is *within* the tempfile.TemporaryDirectory that is chroot'ed per testcase.
  14. # It is also hard-coded in numerous places, so don't change it.
  15. test_temp_dir = "tmp"
  16. # The PEP 561 tests do a bunch of pip installs which, even though they operate
  17. # on distinct temporary virtual environments, run into race conditions on shared
  18. # file-system state. To make this work reliably in parallel mode, we'll use a
  19. # FileLock courtesy of the tox-dev/py-filelock package.
  20. # Ref. https://github.com/python/mypy/issues/12615
  21. # Ref. mypy/test/testpep561.py
  22. pip_lock = os.path.join(package_path, ".pip_lock")
  23. pip_timeout = 60