1
0

sitecustomize.py 472 B

1234567891011121314151617
  1. from __future__ import annotations
  2. import os
  3. import sys
  4. from pathlib import Path
  5. def _looks_like_pytest_process() -> bool:
  6. argv0 = Path(str(sys.argv[0] or "")).name.lower()
  7. if "pytest" in argv0:
  8. return True
  9. return any("pytest" in str(arg).lower() for arg in sys.argv[1:3])
  10. if _looks_like_pytest_process():
  11. # Prevent broken global pytest plugin autoload on this Windows machine.
  12. os.environ.setdefault("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1")