Repository: pytest-dev/pytest
File: src/_pytest/reports.py (Python)

Code before:
                | ExceptionInfo[BaseException]
                | tuple[str, int, str]
                | str
                | TerminalRepr
            ) = None
        else:
            if not isinstance(excinfo, ExceptionInfo):
                outcome = "failed"
                longrepr = excinfo
            elif isinstance(excinfo.value, skip.Exception):
                outcome = "skipped"
                r = excinfo._getreprcrash()
                assert r is not None, (
                    "There should always be a traceback entry for skipping a test."
                )
                if excinfo.value._use_item_location:
                    path, line = item.reportinfo()[:2]
                    assert line is not None
                    longrepr = (os.fspath(path), line + 1, r.message)
                else:
                    longrepr = (str(r.path), r.lineno, r.message)
            elif isinstance(excinfo.value, BaseExceptionGroup):
                if excinfo.value.exceptions and any(
                    isinstance(exception, skip.Exception)
                    for exception in excinfo.value.exceptions
                ):
                    outcome = "skipped"
                    skipped_exceptions = cast(
                        Sequence[BaseException], excinfo.value.exceptions
                    )
                    longrepr = _format_exception_group_all_skipped_longrepr(
                        item, excinfo, skipped_exceptions
                    )
                else:
                    # fall through to your existing failure path
                    outcome = "failed"
                    longrepr = _format_failed_longrepr(item, call, excinfo)
            else:
                outcome = "failed"
                longrepr = _format_failed_longrepr(item, call, excinfo)
        for rwhen, key, content in item._report_sections:
            sections.append((f"Captured {key} {rwhen}", content))
        return cls(
            item.nodeid,
            item.location,
            keywords,
            outcome,
            longrepr,
            when,
            sections,
            duration,

Review comment (suggestion):
The condition we actually want is
```suggestion
            elif isinstance(excinfo.value, BaseExceptionGroup) and (
                excinfo.value.split(skip.Exception)[1] is None
            ):
```
to check that the group contains _only_ skip exceptions, while handling any number of levels of nested groups.  (and we should test the multiply-nested case too)

I'd further suggest merging this with the skip handler above, such that we use item location if _all_ have use-item-location else r.path.

Code after:
            longrepr: (
                None
                | ExceptionInfo[BaseException]
                | tuple[str, int, str]
                | str
                | TerminalRepr
            ) = None
        else:
            if not isinstance(excinfo, ExceptionInfo):
                outcome = "failed"
                longrepr = excinfo
            elif isinstance(excinfo.value, skip.Exception):
                outcome = "skipped"
                r = excinfo._getreprcrash()
                assert r is not None, (
                    "There should always be a traceback entry for skipping a test."
                )
                if excinfo.value._use_item_location:
                    path, line = item.reportinfo()[:2]
                    assert line is not None
                    longrepr = (os.fspath(path), line + 1, r.message)
                else:
                    longrepr = (str(r.path), r.lineno, r.message)
            elif isinstance(excinfo.value, BaseExceptionGroup) and (
                excinfo.value.split(skip.Exception)[1] is None
            ):
                # All exceptions in the group are skip exceptions.
                outcome = "skipped"
                excinfo = cast(
                    ExceptionInfo[
                        BaseExceptionGroup[BaseException | BaseExceptionGroup]
                    ],
                    excinfo,
                )
                longrepr = _format_exception_group_all_skipped_longrepr(item, excinfo)
            else:
                outcome = "failed"
                longrepr = _format_failed_longrepr(item, call, excinfo)
        for rwhen, key, content in item._report_sections:
            sections.append((f"Captured {key} {rwhen}", content))
        return cls(
            item.nodeid,
            item.location,
            keywords,
            outcome,
            longrepr,
            when,
            sections,
            duration,
            start,
            stop,