| 19 | _included: Set[str] # If non-empy, only these tests should be run in this test run |
| 20 | |
| 21 | def __init__( |
| 22 | self, |
| 23 | name: str, |
| 24 | excluded: Optional[Iterable[str]] = None, |
| 25 | included: Optional[Iterable[str]] = None, |
| 26 | ) -> None: |
| 27 | self._excluded = set() |
| 28 | self._included = set() |
| 29 | |
| 30 | if excluded and included: |
| 31 | raise ValueError("Can't specify both included and excluded") |
| 32 | |
| 33 | if "::" in name: |
| 34 | assert ( |
| 35 | not included and not excluded |
| 36 | ), "Can't specify included or excluded tests when specifying a test class in the file name" |
| 37 | self.test_file, test_class = name.split("::") |
| 38 | self._included.add(test_class) |
| 39 | else: |
| 40 | self.test_file = name |
| 41 | |
| 42 | # For testing purposes |
| 43 | if excluded: |
| 44 | self._excluded = set(excluded) |
| 45 | if included: |
| 46 | self._included = set(included) |
| 47 | |
| 48 | @staticmethod |
| 49 | def empty() -> "TestRun": |