(cls)
| 1025 | |
| 1026 | @classmethod |
| 1027 | def files_to_test(cls): |
| 1028 | |
| 1029 | if cls._files_to_test is not None: |
| 1030 | return cls._files_to_test |
| 1031 | |
| 1032 | items = [ |
| 1033 | item.resolve() |
| 1034 | for directory in cls.test_directories |
| 1035 | for item in directory.glob("*.py") |
| 1036 | if not item.name.startswith("bad") |
| 1037 | ] |
| 1038 | |
| 1039 | # Test limited subset of files unless the 'cpu' resource is specified. |
| 1040 | if not test.support.is_resource_enabled("cpu"): |
| 1041 | |
| 1042 | tests_to_run_always = {item for item in items if |
| 1043 | item.name in cls.run_always_files} |
| 1044 | |
| 1045 | items = set(random.sample(items, 10)) |
| 1046 | |
| 1047 | # Make sure that at least tests that heavily use grammar features are |
| 1048 | # always considered in order to reduce the chance of missing something. |
| 1049 | items = list(items | tests_to_run_always) |
| 1050 | |
| 1051 | # bpo-31174: Store the names sample to always test the same files. |
| 1052 | # It prevents false alarms when hunting reference leaks. |
| 1053 | cls._files_to_test = items |
| 1054 | |
| 1055 | return items |
| 1056 | |
| 1057 | def test_files(self): |
| 1058 | with warnings.catch_warnings(): |
no test coverage detected