nox icon indicating copy to clipboard operation
nox copied to clipboard

Provide a `session.normalized_name` beside `session.friendly_name`

Open jrast opened this issue 4 months ago • 1 comments

How would this feature be useful?

The session provides a friendly_name property, however, this is often not a filesystem friendly name which is often required for test outputs like coverage files or junit reports. I propose an additional normalized_name property which returns a name which can be used in filenames.

Describe the solution you'd like

The easiest way would probably be something like this:

@property
def normalized_name(self):
    return _normalize_path('', self.friendly_name)

I did not check the behavior of _normalize_path exactly and how it behaves if the path argument is a empty string.

Describe alternatives you've considered

Currently I either do some normalization on my own or use Path(session.virtualenv.location).name to get the normalized name

Anything else?

No response

jrast avatar Aug 28 '25 16:08 jrast

This can now be written as session.env_dir.name(), is that fine?

henryiii avatar Oct 15 '25 19:10 henryiii