|
14 | 14 | from packaging.requirements import InvalidRequirement |
15 | 15 | from packaging.requirements import Requirement |
16 | 16 |
|
| 17 | +from nox_poetry.poetry import POETRY_VERSION |
| 18 | +from nox_poetry.poetry import POETRY_VERSION_1_2_0 |
17 | 19 | from nox_poetry.poetry import CommandSkippedError |
18 | 20 | from nox_poetry.poetry import DistributionFormat |
| 21 | +from nox_poetry.poetry import IncompatiblePoetryVersionError |
19 | 22 | from nox_poetry.poetry import Poetry |
20 | 23 |
|
21 | 24 |
|
@@ -338,10 +341,21 @@ def install(self, *args: str, **kwargs: Any) -> None: |
338 | 341 | def install_groups(self, groups: List[str], *args, **kwargs) -> None: |
339 | 342 | """Install all packages in the given Poetry dependency groups. |
340 | 343 |
|
| 344 | + Raises: |
| 345 | + IncompatiblePoetryVersionError: The version of poetry installed is less than |
| 346 | + v1.2.0, which is not compatible with installing dependency groups. |
| 347 | +
|
341 | 348 | Args: |
342 | 349 | groups: The poetry dependency groups to install. |
343 | 350 | args: Command-line arguments for ``pip install``. |
344 | 351 | kwargs: Keyword-arguments for ``session.install``. These are the same |
345 | 352 | as those for :meth:`nox.sessions.Session.run`. |
346 | 353 | """ |
| 354 | + if POETRY_VERSION < POETRY_VERSION_1_2_0: |
| 355 | + raise IncompatiblePoetryVersionError( |
| 356 | + f"Installed version of poetry must be >={POETRY_VERSION_1_2_0} in " |
| 357 | + "order to install dependency groups. Current version installed: " |
| 358 | + f"{POETRY_VERSION}" |
| 359 | + ) |
| 360 | + |
347 | 361 | return self.poetry.install_groups(groups, *args, **kwargs) |
0 commit comments