Coverage for tests/conftest.py: 79%

14 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-28 17:24 +0000

1import sys 

2from pathlib import Path 

3import warnings 

4 

5 

6def pytest_ignore_collect(path: Path, config) -> bool: 

7 """ignore any test file ending with `_torch.py` on Python 3.14+ 

8 

9 Also ignore tests/unit/validate_type/ on Python < 3.11 (these use modern type syntax) 

10 """ 

11 path_str: str = str(path).replace("\\", "/") 

12 # TODO[torch-python-3.14]: remove when torch supports Python 3.14 

13 # ignore torch tests on Python 3.14+ 

14 if sys.version_info >= (3, 14): 

15 warnings.warn( 

16 "Ignoring torch tests on Python 3.14+ as torch does not yet support this version" 

17 ) 

18 if path_str.endswith("_torch.py"): 

19 return True 

20 

21 # ignore validate_type tests on Python < 3.11 (they use | union syntax) 

22 if sys.version_info < (3, 11): 

23 warnings.warn( 

24 "Ignoring tests/unit/validate_type/ tests on Python < 3.11 as they use modern type syntax" 

25 ) 

26 if "tests/unit/validate_type/" in path_str: 

27 return True 

28 

29 return False 

30 

31 

32# TODO: get beartype working 

33# from beartype.claw import beartype_all 

34 

35# beartype_all()