diff --git a/nox/sessions.py b/nox/sessions.py index 78a02868..08c9cb42 100644 --- a/nox/sessions.py +++ b/nox/sessions.py @@ -520,6 +520,10 @@ def warn(self, *args: Any, **kwargs: Any) -> None: """Outputs a warning during the session.""" logger.warning(*args, **kwargs) + def debug(self, *args: Any, **kwargs: Any) -> None: + """Outputs a debug-level message during the session.""" + logger.debug(*args, **kwargs) + def error(self, *args: Any) -> "_typing.NoReturn": """Immediately aborts the session and optionally logs an error.""" raise _SessionQuit(*args) diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 2d66ba92..6bcd916d 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -609,6 +609,14 @@ def test_warn(self, caplog): assert "meep" in caplog.text + def test_debug(self, caplog): + caplog.set_level(logging.DEBUG) + session, _ = self.make_session_and_runner() + + session.debug("meep") + + assert "meep" in caplog.text + def test_error(self, caplog): caplog.set_level(logging.ERROR) session, _ = self.make_session_and_runner()