|
| 1 | +import os |
1 | 2 | import sys |
2 | 3 | import typing |
3 | 4 | import pathlib |
@@ -203,18 +204,36 @@ def test_cleanup_noop(package, tmp_path: pathlib.Path): |
203 | 204 |
|
204 | 205 |
|
205 | 206 | @pytest.mark.parametrize( |
206 | | - "package", |
| 207 | + "package,expectedPaths", |
207 | 208 | [ |
208 | | - fakePackage("pyside6"), |
209 | | - fakePackage("pyside6_essentials"), |
210 | | - fakePackage("PySiDe6-AddoNs"), |
| 209 | + [fakePackage("pyside6"), ["shiboken6", "shiboken6_generator"]], |
| 210 | + [ |
| 211 | + fakePackage("pyside6_essentials"), |
| 212 | + [ |
| 213 | + "shiboken6", |
| 214 | + "shiboken6_generator", |
| 215 | + os.path.join("PySide6", "__init__.py"), |
| 216 | + ], |
| 217 | + ], |
| 218 | + [ |
| 219 | + fakePackage("PySiDe6-AddoNs"), |
| 220 | + [ |
| 221 | + "shiboken6", |
| 222 | + "shiboken6_generator", |
| 223 | + os.path.join("PySide6", "__init__.py"), |
| 224 | + ], |
| 225 | + ], |
211 | 226 | ], |
212 | 227 | ) |
213 | | -def test_cleanup(package, tmp_path: pathlib.Path): |
214 | | - (tmp_path / "python" / "shiboken6").mkdir(parents=True) |
215 | | - (tmp_path / "python" / "shiboken6_generator").mkdir(parents=True) |
216 | | - |
217 | | - rez_pip.plugins.getHook().cleanup(dist=package, path=tmp_path) |
218 | | - |
219 | | - assert not (tmp_path / "python" / "shiboken6").exists() |
220 | | - assert not (tmp_path / "python" / "shiboken6_generator").exists() |
| 228 | +def test_cleanup(package, expectedPaths: typing.List[str], tmp_path: pathlib.Path): |
| 229 | + actions = rez_pip.plugins.getHook().cleanup(dist=package, path=tmp_path) |
| 230 | + |
| 231 | + expectedActions = [] |
| 232 | + for path in expectedPaths: |
| 233 | + expectedActions.append( |
| 234 | + rez_pip.plugins.CleanupAction( |
| 235 | + "remove", |
| 236 | + str(tmp_path / "python" / path), |
| 237 | + ) |
| 238 | + ) |
| 239 | + assert actions == [[], expectedActions] |
0 commit comments