Skip to content

Commit

Permalink
Do not skip pre-install commands when --install-only is passed (#311)
Browse files Browse the repository at this point in the history
* fix: Do not skip pre-install commands when --install-only is passed

* build: Require Nox >= 2020.8.22

The `session.run_always` method is only available in 2020.8.22 and later.

Also, avoid the `^` version operator. It implies `< 2021`, preventing
installation of nox-poetry with any new Nox release.
  • Loading branch information
cjolowicz authored Mar 14, 2021
1 parent 2e9140f commit a68f918
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Changelog = "https://github.com/cjolowicz/nox-poetry/releases"

[tool.poetry.dependencies]
python = "^3.6.1"
nox = "^2020.5.24"
nox = ">=2020.8.22"
tomlkit = "^0.7.0"

[tool.poetry.dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/nox_poetry/poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def export(self, path: Path) -> None:
Args:
path: The destination path.
"""
self.session.run(
self.session.run_always(
"poetry",
"export",
"--format=requirements.txt",
Expand Down Expand Up @@ -102,7 +102,7 @@ def build(self, *, format: str) -> str:
if not isinstance(format, DistributionFormat):
format = DistributionFormat(format)

output = self.session.run(
output = self.session.run_always(
"poetry",
"build",
f"--format={format}",
Expand Down
4 changes: 2 additions & 2 deletions src/nox_poetry/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def rewrite(arg: str, extras: Optional[str]) -> str:

args = tuple(rewrite(arg, extras) for arg, extras in args_extras)

self.session.run("pip", "uninstall", "--yes", package, silent=True)
self.session.run_always("pip", "uninstall", "--yes", package, silent=True)

requirements = self.export_requirements()
Session_install(self.session, f"--constraint={requirements}", *args, **kwargs)
Expand Down Expand Up @@ -133,7 +133,7 @@ def installroot(
package = self.build_package(distribution_format=distribution_format)
requirements = self.export_requirements()

self.session.run("pip", "uninstall", "--yes", package, silent=True)
self.session.run_always("pip", "uninstall", "--yes", package, silent=True)

suffix = ",".join(extras)
if suffix.strip():
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, path: Path) -> None:
"""Initialize."""
self.path = path

def run(self, *args: str, **kargs: Any) -> str:
def run_always(self, *args: str, **kargs: Any) -> str:
"""Run."""
path = Path("dist") / "example.whl"
path.touch()
Expand Down

0 comments on commit a68f918

Please sign in to comment.