diff --git a/noxfile.py b/noxfile.py index c7227cf..8c238f4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -557,7 +557,7 @@ def do_not_accept_arguments(session: nox.Session, *, raise_error: bool = True) - def do_not_reuse(session: nox.Session, *, raise_error: bool = True) -> None: """Do not reuse a session with the "-r" or "-R" flags.""" - if session._runner.venv._reused: + if session._runner.venv._reused: # noqa:SLF001 msg = 'be run without the "-r" and "-R" flags' if raise_error: @@ -645,8 +645,9 @@ def skip_install(session: nox.Session) -> bool: """ # Same logic to skip package installation as in core `nox` # See: https://github.com/wntrblm/nox/blob/2026.10.20/nox/sessions.py#L905 - venv = session._runner.venv - return bool(session._runner.global_config.no_install and venv._reused) + no_install = session._runner.global_config.no_install # noqa:SLF001 + venv_reused = session._runner.venv._reused # noqa:SLF001 + return bool(no_install and venv_reused) if MAIN_PYTHON not in SUPPORTED_PYTHONS: diff --git a/pyproject.toml b/pyproject.toml index 39a2e36..a73b259 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,6 +257,8 @@ select = [ # "PL", # flake8-use-pathlib => `pathlib` instead of `os` functions # "PTH", + # flake8-self => No access to private members from outside + # "SLF", # pyupgrade => Modern syntax for the targeted Python version # "UP", ] @@ -541,6 +543,8 @@ select = [ "PL", # flake8-use-pathlib => `pathlib` instead of `os` functions "PTH", + # flake8-self => No access to private members from outside + "SLF", # flake8-print => no `print()` "T20", # pyupgrade => Modern syntax for the targeted Python version @@ -579,7 +583,8 @@ extend-ignore = [ # - PLR0913, PLR0917 => `pytest` passes fixtures as arguments. # - S101 => `assert` statements are ok in the test suite. # - S311 => The `random` module is not used for cryptography. -"tests/**/*.py" = ["ANN0", "ANN2", "D106", "PLR0913", "PLR0917", "S101", "S311"] +# - SLF001 => Tests may set up and inspect private members. +"tests/**/*.py" = ["ANN0", "ANN2", "D106", "PLR0913", "PLR0917", "S101", "S311", "SLF001"] [tool.ruff.lint.flake8-pytest-style] # aligned with [tool.flake8] above