How do I get the name of the currently running nox session? For example, to use the name to customize a coverage file:
import nox
@nox.session(python=['3.6', '3.7', '3.8', '3.9'])
def test(session):
session.install('.')
session.install('pytest', 'pytest-cov')
session.env['COVERAGE_FILE'] = f'.coverage.{session.name}' # <-- what do I put here?
session.run('python', '-m', 'pytest', '--cov', 'tests/')
This information is available at
Session._runner.friendly_name:Because this requires accessing a private attribute, it should be considered unstable in addition to being undocumented.