Skip to content

Commit

Permalink
Fix nox lint session for nox >= 2024.03.02
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb committed Oct 6, 2024
1 parent 618be7e commit 677c21f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,25 @@ def _lint_pre_commit(session, rcfile, flags, paths):
)

# Let's patch nox to make it run inside the pre-commit virtualenv
session._runner.venv = VirtualEnv(
os.environ["VIRTUAL_ENV"],
interpreter=session._runner.func.python,
reuse_existing=True,
venv=True,
)
try:
# nox >= 2024.03.02
# pylint: disable=unexpected-keyword-arg
venv = VirtualEnv(
os.environ["VIRTUAL_ENV"],
interpreter=session._runner.func.python,
reuse_existing=True,
venv_backend="venv",
)
except TypeError:
# nox < 2024.03.02
# pylint: disable=unexpected-keyword-arg
venv = VirtualEnv(
os.environ["VIRTUAL_ENV"],
interpreter=session._runner.func.python,
reuse_existing=True,
venv=True,
)
session._runner.venv = venv
_lint(session, rcfile, flags, paths, tee_output=False)


Expand Down

0 comments on commit 677c21f

Please sign in to comment.